An .iconset is the form developers work with: an ordinary folder of PNG files,
one for each size. Apple’s iconutil command compiles the folder into a single
.icns file, and can turn an .icns file back into a folder. This part
of the format is the part Apple documents, in its
guide
to high resolution and in the iconutil manual page.
File names
The folder must be named <name>.iconset. Apple gives the names of the
files inside as:
icon_<sizeinpoints>x<sizeinpoints>[@<scale>].png
A complete set is ten files. A double-density file has twice as many pixels on each side as its points. Apple notes that a complete set is not required, and that the system picks the best representation for the sizes that are missing.
| File in the folder | Points | Pixels | Element | Stored on macOS 27 as |
|---|---|---|---|---|
icon_16x16.png | 16 | 16 × 16 | ic04 | ARGB, run-length encoded |
icon_16x16@2x.png | 16 | 32 × 32 | ic11 | PNG |
icon_32x32.png | 32 | 32 × 32 | ic05 | ARGB, run-length encoded |
icon_32x32@2x.png | 32 | 64 × 64 | ic12 | PNG |
icon_128x128.png | 128 | 128 × 128 | ic07 | PNG |
icon_128x128@2x.png | 128 | 256 × 256 | ic13 | PNG |
icon_256x256.png | 256 | 256 × 256 | ic08 | PNG |
icon_256x256@2x.png | 256 | 512 × 512 | ic14 | PNG |
icon_512x512.png | 512 | 512 × 512 | ic09 | PNG |
icon_512x512@2x.png | 512 | 1024 × 1024 | ic10 | PNG |
The last two columns are not from Apple. They come from compiling a complete set with
iconutil on macOS 27 and reading the result. That file held these ten elements,
not sorted by size, followed by an info
element. It had no TOC or icnV.
iconutil
To compile a folder into an icon file, and to take one apart again:
iconutil -c icns MyApp.iconset
iconutil -c iconset MyApp.icns
The output goes beside the input, or to the path given with -o. In Xcode,
adding an .iconset folder to a project compiles it when the project is
built.
Taking an icon file apart gives one PNG for each size it holds. A run-length encoded element comes out as a new PNG file.