You can do this with the hdiutil tool. The appropriate configuration in your case would be:
hdiutil create -size 50m -fs HFS+ -volname Widget /path/to/save/widget.dmg
Obviously change the "Widget" and path to whatever you need.
A few additional options that may be useful:
-srcfolder /path/to/source This will create the disk image with the data in the specified folder as the contents.
-megabytes 50 used instead of -size 50m. This will use binary sized megabytes (2^20 bytes) instead of decimal (10^6 bytes).
-srcdevice /dev/diskXsY This is like srcfolder, but makes a block-based copy from another device, like a hard drive partition or DVD. Useful for making clones and images of install disks, etc.