PNGcheck is a simple text-only program to check the structure of a PNG file, and to decode the contents of standard PNG chunks to human readable form. It is totally self-contained, so it does not need any other libraries like libpng or zlib. It does not need (nor use) graphics capability, so it is ideal for checking a large number of images automatically. Because it does not use the zlib compression library it can not check the contents of compressed chunks like IDAT or zTXt for correctness. However, since PNG has checksums on a per-chunk basis, which PNGcheck uses, it is extremely unlikely that there is a data error in one of these blocks that would go undetected. Unfortunately, it is not possible to test for missing or extra image data (usually the result of images incorrectly written by the encoder). Besides just checking that each chunk in a PNG file is not corrupted, PNGcheck also checks that the order of the chunks is in accordance with the PNG specification, and if there are duplicates of chunks of which there should be only one. PNGcheck can optionally output the contents of the chunks it understands (all of the chunks in the PNG specification and extension documents). Command-line options are: -v test verbosely (output chunk name, location, and decode most contents) -q test quietly (only output errors) -t print contents of tEXt chunks (can be used with -q) -7 print contents of tEXt chunks, escape chars >=128 (for 7bit terminals) -p print contents of PLTE (palette) chunks (can be used with -q) -f force continuation even after errors -s search a file of stream for an embedded PNG -x extract embedded PNG(s) from a file or stream Recent updates to the PNGcheck code: Ver 1.95 fixed two tRNS errors reported by someone from W3C (whose name I currently don't remember) (complained about missing palette in greyscale images, missing breaks in case statement) avoid reference to undefined array entry with out of range ityp Ver 1.96 removed extra linefeed from cHRM chunk when not in verbose mode added test to see if sBIT contents are valid added test for zero image width or height in IHDR added test for insufficient IDAT data (minimum 10 bytes) Ver 1.97 allow -p option to output image palette in both decimal and hex Ver 1.98 added -s option to search for embedded PNG(s) in a file or stream added -x option to extreact embedded PNG(s) from a file or stream added test for valid tEXt/zTXt keywords per PNG 1.0 specification decode zlib header bytes from first IDAT now returns error status to shell (0 = no errors, >0 = error) Alexander Lehmann Andreas Dilger Greg Roelofs Glenn Randers-Pehrson John Bowler