Comments on this document can be sent to the PNG specification maintainers at
png-info@uunet.uu.netor at
png-list@dworkin.wustl.edu.
Distribution of this memo is unlimited.
At present, the latest version of this document is available on the World Wide Web from
ftp://swrinde.nde.swri.edu/pub/png-group/documents/.
Permission is granted to copy and distribute this document for any purpose and without charge, provided that the copyright notice and this notice are preserved, and that any substantive changes or deletions from the original are clearly marked.
png-info@uunet.uu.net.The basic PNG specification is available from the W3C archive at
http://www.w3.org/pub/WWW/TR/WD-png.
Whenever you use any of these unregistered chunks you should also include a "tEXt" chunk describing it, for example:
tEXtComment\0 This file contains a faLT chunk written according to the format given in Version 19970203 of the PNG Proposed Chunks document.For those proposed chunks that have a "signature" field, decoders should check to ensure that the signature field is present and that its contents exactly match the specified string.
Proposed Multiple Ordering chunk name OK? constraints fALS No Before IDAT
This chunk's contents are a text string (purpose) that names the palette, followed by a null separator, [a 20-byte signature and a null-byte separator] a gamma field, and a series of false-color palette entries:
n bytes: purpose (Latin-1 text) 1 byte: null separator 20 bytes: signature ("PNG group 1996-10-27") 1 byte: null separator 4 bytes: gamma (unsigned integer), file_gamma times 100000 2 bytes: index (unsigned integer), range [0 .. (2^sample_depth) -1)] 2 bytes: red (unsigned integer) range [0 .. 65535] 2 bytes: green (unsigned integer) range [0 .. 65535] 2 bytes: blue (unsigned integer) range [0 .. 65535] etc.The number of entries is determined from the remaining chunk length after the gamma field. This length not divisible by 8 is an error.
The "purpose" identifies the palette, which can permit applications or people to choose the appropriate one when more than one false-color palette is stored in a multiple-image file. The "purpose" string must follow the format of a "tEXt" keyword, i.e. 1-79 printable Latin-1 characters.
The gamma field gives the value of "file_gamma", times 100000, that is associated with the false-color palette samples.
This chunk can appear for color type 0 or color type 4. If it appears for any other color type, it will be ignored.
The complete 2^sample_depth-entry false-color palette can be built from the chunk data. If the first entry (index value 0) is missing, it will be assumed to be {0, 0, 0} (black). If the last entry (index value 2^sample_depth - 1) is missing, it will be assumed to be {65535, 65535, 65535} (white). The red, green, blue samples for other missing entries are filled in by linearly interpolating between the samples that are present, independently for each of the three color components.
Once the complete false-color palette is established, it is used similarly to PLTE. The first entry in the completed false-color palette is referenced by the grayscale value 0, the second by grayscale value 1, etc.
If the "tRNS" chunk is present, its value is compared to the graylevel, not to the converted false-color of the pixels. If the "bKGD" chunk is present, background pixels will be displayed in the false-color corresponding to the grayscale value found in the "bKGD" chunk. The "cHRM" and alpha conversions, if present, are applied to the color samples in the converted false-color pixels. The "gAMA" chunk is ignored when the "faLT" chunk is processed, and the supplied "file_gamma" value is used instead.
Note that the "gAMA" and other values must be selected so that the grayscale image is meaningfully displayed when the "faLT" chunk is unrecognized or ignored.
If this chunk does appear, it must precede the first "IDAT" chunk. There can be only one "faLT" chunk in a PNG datastream.