How do I create a DMG file from a directory?
If you want to do it from the command line, hdiutil will provide more control than Disk Utility over how the DMG is created. As an example, you can use hdiutil like so:
hdiutil create -volname WhatYouWantTheDiskToBeNamed -srcfolder /path/to/the/folder/you/want/to/create -ov -format UDZO name.dmg

See man hdiutil for more details.