The PNG Guide is an eBook based on Greg Roelofs' book, originally published by O'Reilly.



ICC Profiles

For ultimate control over color fidelity and issues of device dependence, PNG supports the ability to embed a full International Color Consortium profile via the iCCP chunk. The ICC profile format, at version 3.4 as of this writing, is a relatively mature specification that is itself headed toward ISO standardization. The format is capable of describing not only computer monitors, but also printers, scanners, liquid crystal displays, film, transparencies, and so forth.

Though the profile format itself is understandably quite complex, given all of the devices and color-space conversions it must encompass, the format of PNG's iCCP chunk is independent of all that. Similar to the zTXt chunk (which will be described in Chapter 11, "PNG Options and Extensions"), iCCP contains only four elements, as shown in Table 10-4: a printable name terminated by a null byte; a byte indicating the compression method; and the compressed profile itself.

Table 10-4. iCCP Chunk

Field Length and Valid Range
Profile name 1-79 bytes (Latin-1 text)
Null separator 1 byte (0)
Compression method 1 byte
Compressed ICC profile n bytes

The profile name is for the convenience of the artist or user of the image; in practice, it will probably be similar to the profile description tag, which is embedded in the profile itself. The compression method byte currently must be zero, indicating a compressed stream in zlib format, using the deflate compression method. As with zTXt and the actual image data, a future major revision of the PNG spec may define other compression methods, in which case this byte will be allowed to take on other values.

Aside from uncompressing it, ordinary decoders will not be expected to know anything about the ICC profile other than the fact that they can be large (i.e., more than 64 KB); instead, they will simply hand it off to the local color management system for appropriate processing. Encoders should ensure two things: that the profile is a valid ICC profile and that it refers either to an RGB color space (for color images, including colormapped ones) or to a grayscale color space. CMYK color spaces, for example, are disallowed. Likewise, multiple copies of iCCP are disallowed; if the iCCP chunk is present, it must come before any PLTE or IDAT chunks.

By mid-1998, there were indications that something of a ``TIFF effect'' applied to the ICC profile format; that is, profiles from different vendors were not necessarily interoperable with each other or with different color management systems.[84] Presumably this will be worked out by the time the ICC specification becomes an official standard, but in the meantime, it is something of which PNG implementors should be aware.

[84] This is hardly surprising for a format that attempts to deal with such a thorny problem.




Last Update: 2010-Nov-26