From the Apple Help menu:
Creating a disk image of a device, folder, or volume
You can use Disk Utility to create an image of a single device, folder, or volume. You can use the disk image to transfer files from one computer to another, or burn the image on a CD or DVD disc that you can use to restore the contents of another disk.
If you want to create a disk image of files that are in different locations, gather them into a single folder or onto a single volume before you begin.
You can create a full disk image that uses the same amount of disk space as the disk it represents, or create a sparse disk image that includes only the data on the disk. For example, a 10MB disk may have only 5MB of data. A full disk image would be 10MB, while a sparse disk image would be 5MB.
1. Open Disk Utility, located in Applications/Utilities.
2. If you're creating a disk image from a folder, choose Images > New > "Image from Folder." Then select the folder you want from the navigation window.
If you're creating a disk image from a device or volume, select it in the list on the left side of the Disk Utility window, then choose Image > New > "Image from [disk or volume name]."
3. Type a name for the image, and choose a disk format.
4. Choose Encryption, if desired, then click Save.
The name of the disk image is followed by the filename extension ".dmg."