ZERO-UPLOAD SANDBOX
.png Tier 1 · Deep AST Parser

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.

MIME Types image/png
Byte Endianness big
PRONOM PUID fmt/11
0xFF

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

Binary Signature & Wire Layout

.png Magic Bytes & Header Offset Map

Offset: 0x00 (0 B) ASCII: .PNG....
89 50 4E 47 0D 0A 1A 0A

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
Upload Gateway & AppSec Advisory

.png Security & Polyglot Risk Matrix

Risk Level: low
Arbitrary Code / Macros
NO (Inert Data)
Pickle Deserialization
SAFE (No Pickle VM)
XML External Entity (XXE)
NONE
Polyglot Prepend Risk
LOW (Strict 0x00 Magic)
Backend Upload Validation Recommendation

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).

Compiler-Verified Reference Code

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}")
CI/CD & Unit Test Fixtures

Deterministic .png Sample Files & Edge Cases

Open Full .png Sample Matrix & Mutator →
minimalexpect: valid

minimal-2x2-rgba.png

Real 8-bit RGBA PNG encoded by Pillow with valid CRC32 checksums on every chunk.

↓ Download (83 B)
SHA-256: 275f56b84188ce563dfa9364ba7d2b3dfec7beb5d62de11bddcafb0390e85752
Exact: 83 bytes
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 -c
realisticexpect: valid

ai-prompt-metadata.png

16×16 RGBA PNG from Pillow containing AI generation prompt metadata inside a standard tEXt chunk.

↓ Download (305 B)
SHA-256: 1c159eb8d483c4379933d83bac5ba8581b50e5651f9877c059e999cc102840de
Exact: 305 bytes
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 -c
edge-caseTruncated IDAT Payloadexpect: parser_error

truncated-idat.png

Real Pillow PNG truncated inside the compressed IDAT payload — decode must fail (missing IEND alone would still decode).

↓ Download (47 B)
SHA-256: ac4cc6aeb4c37baeee650f26c1651411aaade073ecee5db776d40defcac6e53a
Exact: 47 bytes
curl -fsSL https://fileformat.co/fixtures/v1/png/truncated-idat.png -o truncated-idat.png \
  && echo "ac4cc6aeb4c37baeee650f26c1651411aaade073ecee5db776d40defcac6e53a  truncated-idat.png" | shasum -a 256 -c

Related Specifications & Alternatives