.ICO
OS/2 colour icon (CI)
Introduction
The OS/2 colour icon is a BMP file with the type code CI that holds two
bitmaps one after the other. The first is the same 1-bit pair of masks as a
black and white icon, which decides where the icon
is transparent. The second is a colour image that gives the colour of the rest.
Colour icons are usually named .ico, which on Windows means a
different format. A file with several sizes is a
bitmap array whose entries are CI
images.
Software
Structure
All the headers come first and the pixels after them. Each of the two file headers
starts with CI and holds the offset of its own bitmap’s pixels. All numbers
are little-endian.
0File headerCI, size, hotspot and the offset of the masks14 bytes14DIB header for the masks: width, double height, 1 bit per pixel12 to 64 bytes…Colour table for the masks, two entries6 or 8 bytes…Second file headerCIagain, with the offset of the colour image14 bytes…DIB header for the colour image, at the icon’s real height12 to 64 bytes…Colour table for the colour imagevaries…Masks 1-bit rows: the AND mask and the XOR mask one above the othervaries…Colour image rows, stored like a bitmap’s pixelsvaries
The file header fields are the same as in a black and white icon, with the hotspot in the two fields a bitmap reserves.
Telling it apart
The file starts with CI (43 49). After the first DIB header
and its two-entry colour table comes a second file header, also starting with
CI. An OS/2 colour pointer is laid
out the same way and differs only in its type code, CP. A Windows
.ico file starts with 00 00 01 00.
Also used for
- Windows icon .ico