Image file formats
Mini-course at ICERM
Arnaud Chéritat

Page *

Back


File structure
Open crop.png with a hex viewer, then with TweakPNG
NOTE: on other systems ImageMagick provides a command line tool:

identify -verbose image.png

Structure of a PNG:
PNG signature IHDR chunk chunks IEND chunk
8B (bytes)25B12B
Structure of a chunk:
Length of
data section
Name Data section Checksum
4 bytes 4 bytes from 0 to
231-1 bytes
4 bytes
Multi-byte integer ordering convention: big endian.

Encoding 10000 = 39*256+16 as a four byte int gives
first byte: 00, second byte: 00, third byte: 39, last byte: 16

IHDR chunk : Header

00 00 00 0D49 48 44 524B4B1B1B1B1B1B** ** ** **
data len=13I H D Rwidthheightbit
depth
color
type
compr.
meth.
filter
meth.
interlace
method
checksum
IEND chunk : End of file
00 00 00 0049 45 4E 44AE 42 60 82
[length=0]I E N D [checksum]

Header:

I strongly recommend reading part or all of the PNG specification.

More metadata
Open a3.png with TweakPNG

Open P1030418.JPG with XnView

To * page