Chromium's .icns files
Sizes
.icns files contain multiple sizes of icons. The standard .icns files for
Chromium contain icons of the following sizes:
| Size | Type |
|---|---|
| 16×16 | 'is32'/'s8mk' |
| 32×32 | 'il32'/'l8mk' |
| 128×128 | 'it32'/'t8mk' |
| 256×256 | 'ic08' (PNG) |
| 512×512 | 'ic09' (PNG) |
Rationale
The rationale behind these choices is to avoid bugs in icon display. As noted in a bug, having @2x versions of the smaller icons causes blockiness on retina Macs, and in fact, sometimes just having @2x versions of icons would cause them to be preferred even when it doesn't make sense.
At least through macOS 10.11, using the modern ('icp4'–'icp6') types causes
scrambling of the icons in display. If the old types work, why mess with them?
Source PNG files
Use whatever tools you want to create the PNG files, but please note that the
dimensions of the images in the PNG files must match exactly the size indicated
by their filename. This will be enforced by the makeicns2 tool below.
Construction
The tools for .icns construction can be found in src/tools/mac/icons.
Compile makeicns2 before you begin by following the directions in its header
comment.
In addition, you will need optipng and advpng, which can be found in the
optipng and advancecomp packages, respectively, in your favorite port
manager.
To construct an .icns file:
- Assemble a directory (
.iconset) containing the five required sizes of icon, in PNG format: 16×16, 32×32, 128×128, 256×256, and 512×512, named16.png,32.png,128.png,256.png, and512.png, respectively. - Process the
.pngfiles with:optipng -o7 -zm1-9advpng -z4 -i50png_fix.py
- Create the
.icnsfile with themakeicns2you compiled:makeicns2 <name>.iconset
Deconstruction and other tools
In the src/tools/mac/icons/additional_tools directory there are several other
tools that you may find useful in your quest to craft the perfect icons. They
are:
makeicns: This tool takes an.iconsetdirectory of.pngfiles and creates an.icnsfile containing them. However, it cannot create the old-style data/mask image pairs, which is whymakeicns2is preferred.unmakeicns: This tool takes an.icnsfile and unpacks it into its constituent images. For the old-style data/mask image pairs, this tool will reconstitute the two into a more useful.pngfile.unpackicon: This tool is used by theunmakeicnstool. It takes the data from an old-style data/mask image pair, which is encoded with a simple PackBits-esque RLE scheme, and outputs the data uncompressed. It is available separately should this be a capability you require.makepng: This tool is used by theunmakeicnstool. It reconstructs a.pngfile from the uncompressed data of an old-style data/mask image pair. It is available separately should this be a capability you require.maketoc.py: This tool can be used to both create aTOCsection for an.icnsfile, as well as verify one. Themakeicns2tool automatically creates aTOCsection, but this tool's verification of these sections may be useful.
To compile these tools, run make in their containing directory. Note that
libpng is required.