Icons

On Mac OS/X, icons are stored in special .icns files. These files can contain several versions of the icon, as well as in some cases the required bitmasks. The main icon is 128x128 and uses alpha blending. Next to this, the developer can define 16x16, 32x32, and 48x48 versions, which use a 1-bit bitmask instead of alpha blending. These smaller versions serve as 'hints', which Mac OS/X can use instead of scaling the 128x128 version, which might lead to undesired blurriness.

Several icons can be associated with a single application. First of all, the application icon is used to identify the application itself, for instance in Finder and in the Dock. Next to this, document icons are used to identify the documents associated with the application. Different icons are required to be able to distinguish visually between applications and documents in Finder. Finally, the developer can use custom icons for folders or disk images associated with the application.

Obtaining default icons

When designing new icons, it is practical to have the default ones available. A document icon for instance could be a modification of the general document icon shipped with Mac OS/X. Many of the default icons can be found in /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources.

A different way of obtaining an icon is by selecting it in Finder, perform Cmd-C (Copy), open Preview, perform Cmd-N (New From Clipboard). This copies the icon to preview, maintaining transparency information and shape.

Creating icons

If XCode is installed, the developer has the Icon Composer (in /Developer/Applications/Utilities) available, which allows the creation and modification of .icns files.

Associating your application with icons

The application and document icons are associated with the application using the Info.plist file shipped with the bundle.

To associate a disk image (.dmg) with an icon, rename the icon file to .VolumeIcon.icns and place it in the root of the disk image. It may be required to mount the (read/write) image, perform /Developer/Tools/SetFile -a C /path/to/mountpoint and unmount it again to get the icon to be recognised properly. Test whether this is necessary in your case.