.ICNS
Apple Icon Image
Introduction
ICNS is the icon format of macOS. An application bundle keeps its icon as an
.icns file, holding the same picture at sizes from 16 to 1024 pixels square,
including double resolution versions for Retina screens. Finder and the Dock pick the size
they need.
Developers usually make one from a folder of PNG files named by size, an
.iconset, using Apple’s iconutil command or Xcode.
Software
Structure
An ICNS file starts with the four letters icns and the total file length,
a 4-byte big-endian number. The rest is a list of elements, each a four-letter type, a
4-byte length that includes this 8-byte element header, and the data.
The type says what the element holds. Modern types store PNG data (or JPEG 2000):
ic07 is 128 pixels, ic08 256, ic09 512 and
ic10 1024, with ic11 to ic14 for the double
resolution versions of the smaller sizes. Older types such as is32 and
il32 hold run-length encoded colour, paired with separate 8-bit masks such as
s8mk. Optional TOC and icnV elements list the
contents and give a version.
0Headericnsand the file length8 bytes8Elements repeated: type, length, PNG or bitmap datavaries