Technical Specifications 5 of 7
File Structure
A PNG file begins with a fixed eight-byte signature followed by an ordered series of chunks. Every chunk contains a length, a four-byte chunk type, chunk data, and a cyclic redundancy check.
Encoding pipeline
Pixel rows
The image is represented as scanlines.
Filtering
Each scanline uses an allowed filter to improve compressibility.
Compression
Filtered scanlines are compressed with PNG compression method 0.
IDAT storage
The compressed datastream is divided across one or more IDAT chunks.
Integrity check
Each chunk carries a CRC for its type and data.
Core chunk structure
| Element | Purpose |
|---|---|
| PNG signature | Identifies the datastream as PNG and helps detect transfer problems |
| IHDR | Defines width, height, bit depth, color type, compression, filtering, and interlacing |
| PLTE | Stores the palette; required for indexed-color images and permitted for some truecolor images |
| IDAT | Contains the filtered and compressed image data across one or more chunks |
| IEND | Marks the end of the PNG datastream |
| Ancillary chunks | May carry transparency, profiles, gamma, text, physical dimensions, timestamps, Exif data, and other information |
Unknown ancillary chunks can often be ignored safely, while unknown critical chunks prevent a decoder from reliably interpreting the image.