File structure Header Icon data Compression Icon types Other types
Support
External links
See also
References
{{Use mdy dates|date=October 2013}}{{Infobox file format | name = Apple Icon Image | icon = | extension = .icns | mime = | type code = icns | uniform type = com.apple.icns | owner = Apple Inc. | genre = icon file format | container for = | contained by = | extended from = | extended to = }}
The Apple Icon Image format is the icon format used in Apple Inc.'s macOS. It supports icons of 16 × 16, 32 × 32, 48 × 48, 128 × 128, 256 × 256, 512 × 512, and 1024 × 1024 pixels, with both 1- and 8-bit alpha channels and multiple image states (example: open and closed folders). The fixed-size icons can be scaled by the operating system and displayed at any intermediate size.
File structure
The file format consists of an 8 byte header, followed by any number of icons.
Header
Offset
Size
Purpose
0
4
Magic literal, must be "icns" (0x69, 0x63, 0x6e, 0x73)
4
4
Length of file, in bytes, msb first
Icon data
Offset
Size
Purpose
0
4
Icon type, see OSType below.
4
4
Length of data, in bytes (including type and length), msb first
8
Variable
Icon data
Compression
{{small>value
{{small>bytes
{{small>uncompressed
{{samp| 0}}…{{samp|127}}}}
{{samp|1}}…{{samp|128}}}}
{{samp|1}}…{{samp|128}}}} bytes
{{samp|128}}…{{samp|255}}}}
{{samp|1}}}} byte
{{samp|3}}…{{samp|130}}}} copies
Over time the format has been improved and there is support for compression of some parts of the pixel data. The 32-bit ("is32", "il32", "ih32","it32") and ARGB ("ic04", "ic05") pixel data are often compressed (per channel) with a format similar to PackBits.[1]
Some sources mentioned that the OS supports both compressed or uncompressed data chunks.
1024×1024 in 10.7 (or 512x512@2x "retina" in 10.8) icon in JPEG 2000 or PNG format
ic11
varies
32
10.8
16x16@2x "retina" icon in JPEG 2000 or PNG format
ic12
varies
64
10.8
32x32@2x "retina" icon in JPEG 2000 or PNG format
ic13
varies
256
10.8
128x128@2x "retina" icon in JPEG 2000 or PNG format
ic14
varies
512
10.8
256x256@2x "retina" icon in JPEG 2000 or PNG format
ic04
varies
16
16x16 ARGB
ic05
varies
32
32x32 ARGB
icsB
varies
36
36x36
icsb
varies
18
18x18
the values inside the brackets () in the length column is the uncompressed length.
the ARGB format consists of the ascii values for 'ARGB' and the four compressed channels tightly packed
Other types
OSType
Length (bytes)
Description
'TOC '
varies
"Table of Contents" a list of all image types in the file, and their sizes (added in Mac OS X 10.7)
'icnV'
4
4-byte big endian float - equal to the bundle version number of Icon Composer.app that created to icon
'name'
Unknown
'info'
259
Info binary plist. Usage unknown
Support
Various image viewers can load *.icns files, and free and open source converters from or to PNG also exist.[2][3] GTK+ can load *.icns resources since 2007.[4] Other tools supporting the format include the Apple Icon Composer and icns Browser, The Iconfactory, and IconBuilder.
MacOS offers the built-in iconutil command line tool to pack and unpack *.icns files.
External links
IconFamily – Open source Objective C class to read and write Apple icns files
[https://github.com/sveinbjornt/osxiconutils osxiconutils] - Command line tools to work with Apple icns files
See also
ICO format on Windows
X PixMap format for X11
References
1. ^Macintosh Icons 2. ^{{cite web|url=http://icns.sourceforge.net/|title=libicns|publisher=SourceForge project icns|date=2009|accessdate=2016-08-18}} 3. ^{{cite web|url=https://github.com/moinism/png2icns|title=png2icns|publisher=Moin Uddin|date=2016|accessdate=2017-05-25}} 4. ^{{cite web|url=http://ezix.org/project/wiki/MacOSXIcons|title=Mac OS X icons for GTK+|author=Lyonel Vincent|date=2007|accessdate=2016-08-18}}