Portable Network Graphics (PNG)
Lossless CRC-checked chunked raster image format, heavily used in AI workflows (ComfyUI / Stable Diffusion) to store generation graphs and prompts inside `tEXt`/`iTXt` chunks.
The 8-byte signature (`89 50 4E 47 0D 0A 1A 0A`) intentionally detects 7-bit ASCII stripping, CRLF<->LF line-ending conversion, and EOF truncation immediately.
Drop any .png file (even 100 GB+) to inspect locally
Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded
.png Magic Bytes & Header Offset Map
8-byte PNG transport-integrity signature
| Byte Offset | Length | Data Type | Field Name | Engineering Description |
|---|---|---|---|---|
| 0x00 - 0x07 | 8 B | uint8[8] | png_sig | 89 50 4E 47 0D 0A 1A 0A |
| 0x08 - 0x0F | 8 B | u32_be+char[4] | ihdr_hdr | Length (13) + 'IHDR' chunk type |
| 0x10 - 0x17 | 8 B | uint32_be[2] | dimensions | Width and Height in pixels |
| 0x18 - 0x1C | 5 B | uint8[5] | pixel_fmt | Bit depth, color type, compression, filter, interlace |
.png Security & Polyglot Risk Matrix
Check width * height <= max_pixels from bytes 0x10..0x17 BEFORE zlib decompression, and strip ancillary tEXt/iTXt/eXIf chunks to prevent metadata leaks (and Acropalypse-style trailing byte leaks after IEND).
Read .png Header & Metadata Without Heavy Dependencies
import struct, sys
with open(sys.argv[1], "rb") as f:
sig, length, ctype, w, h, depth, color = struct.unpack(">8sI4sIIBB", f.read(26))
assert sig == b"\x89PNG\r\n\x1a\n" and ctype == b"IHDR"
print(f"PNG {w}x{h}px, {depth}-bit color_type={color}")Deterministic .png Sample Files & Edge Cases
minimal-2x2-rgba.png
Real 8-bit RGBA PNG encoded by Pillow with valid CRC32 checksums on every chunk.
curl -fsSL https://fileformat.co/fixtures/v1/png/minimal-2x2-rgba.png -o minimal-2x2-rgba.png \
&& echo "275f56b84188ce563dfa9364ba7d2b3dfec7beb5d62de11bddcafb0390e85752 minimal-2x2-rgba.png" | shasum -a 256 -cai-prompt-metadata.png
16×16 RGBA PNG from Pillow containing AI generation prompt metadata inside a standard tEXt chunk.
curl -fsSL https://fileformat.co/fixtures/v1/png/ai-prompt-metadata.png -o ai-prompt-metadata.png \
&& echo "1c159eb8d483c4379933d83bac5ba8581b50e5651f9877c059e999cc102840de ai-prompt-metadata.png" | shasum -a 256 -ctruncated-idat.png
Real Pillow PNG truncated inside the compressed IDAT payload — decode must fail (missing IEND alone would still decode).
curl -fsSL https://fileformat.co/fixtures/v1/png/truncated-idat.png -o truncated-idat.png \
&& echo "ac4cc6aeb4c37baeee650f26c1651411aaade073ecee5db776d40defcac6e53a truncated-idat.png" | shasum -a 256 -cRelated Specifications & Alternatives
RIFF-based modern raster image container supporting lossy (`VP8 `), lossless (`VP8L`), and extended alpha/animated/EXIF (`VP8X`) bitstreams.
Royalty-free HDR & wide-gamut next-gen web image format wrapping AV1 keyframes inside an ISO Base Media (`ftyp`) container (`major_brand` = `avif` or `avis`).
Marker-segmented DCT lossy image format (`FF D8 FF ... FF D9`), where embedded APP1 EXIF TIFF headers carry camera rotation flags (`Orientation=6`) and GPS coordinates.