Skip to content

Pngcheck

A tool to test PNG image files for corruption, display size, type, compression info.

pngcheck is the official PNG tester and debugger. Originally designed simply to test the CRCs within a PNG image file (e.g., to check for ASCII rather than binary transfer), it has been extended to check and optionally print almost all the information about a PNG image and to verify that it conforms to the PNG specification. It also includes partial support for MNG animations.

It can dump the chunk-level information in the image in human-readable form. For example, it can be used to print the basic stats about an image (dimensions, bit depth, etc.); to list the color and transparency info in its palette; or to extract the embedded text annotations. All PNG and JNG chunks are supported, plus almost all MNG chunks (everything but PAST, DISC, tERm, DROP, DBYK, and ORDR). This is a command-line program with batch capabilities.

Installation

$ sudo apt install pngcheck

We will now use pngcheck with the following Image image.png

Usage

$ pngcheck -v image.png
File: image.png (40711 bytes)
  chunk IHDR at offset 0x0000c, length 13
    2560 x 1440 image, 32-bit RGB+alpha, non-interlaced
  chunk bKGD at offset 0x00025, length 6
    red = 0x00ee, green = 0x00ee, blue = 0x00ee
  chunk pHYs at offset 0x00037, length 9: 2835x2835 pixels/meter (72 dpi)
  chunk IDAT at offset 0x0004c, length 8192
    zlib: deflated, 32K window, maximum compression
  chunk IDAT at offset 0x02058, length 8192
  chunk IDAT at offset 0x04064, length 8192
  chunk IDAT at offset 0x06070, length 8192
  chunk IDAT at offset 0x0807c, length 7799
  chunk IEND at offset 0x09eff, length 0
No errors detected in image.png (9 chunks, 99.7% compression).

References

For more information about the tool,

$ man pngcheck