Inside an Image File: Binary Structures
Every image format has a binary grammar. PNG uses length-prefixed chunks with CRC checksums; JPEG uses FF-prefixed markers. Hover the segments to explore.
PNG 签名
固定 8 字节 \x89PNG\r\n\x1a\n,标识文件为 PNG。
PNG 由「长度 + 类型 + 数据 + CRC」的块(chunk)组成;JPEG 由 FF 开头的标记(marker)分段。
PNG chunks
A PNG chunk is Length + Type + Data + CRC32. IHDR stores dimensions and color type, IDAT holds DEFLATE-compressed pixels, and IEND terminates the file. Metadata like text and timestamps live in ancillary chunks.
JPEG markers
JPEG segments start with 0xFF markers: SOI (FFD8), APP0/APP1 for JFIF/EXIF, DQT for quantization tables, SOF for dimensions, SOS for Huffman-coded data, and EOI (FFD9).
Why it matters
Understanding binary structure explains where EXIF lives, why metadata can be stripped without touching pixels, and how compression quality is encoded in quantization tables.