Skip to content
YadeWira edited this page Jun 13, 2026 · 2 revisions

packPNG

Lossless, byte-exact recompressor for the PNG family — PNG / APNG / JNG / MNG.

packPNG shrinks an image file and reconstructs the byte-identical original (same SHA-256), not just the same pixels. It undoes the deflate exactly (via preflate) and re-stores the image with a real codec (WebP-lossless by default). One self-contained, cross-platform binary covers the whole Network Graphics family.

packPNG a image.png          # → image.ppg   (PNG/APNG → TCIP, preflate + WebP-lossless)
packPNG a clip.mng           # → clip.ppg    (MNG → TCIM)
packPNG a photo.jng          # → photo.ppg   (JNG → TCIJ, packJPG)
packPNG x image.ppg          # restore the exact original file (byte-identical)
packPNG a -r -od out/ src/   # recurse, write all outputs into out/

Why not just convert to BMP/WebP/whatever?

Pixel-lossless conversion (PNG→BMP→…→PNG) reproduces the same pixels but a different file — different deflate stream, filters, chunk order → different hash. packPNG reproduces the exact bytes, which is what matters for deduplication, content-addressed storage, archival/verification, and re-serving signed assets. The byte-exact step is the hard part.

Pages

  • Backends — the backends (TCIP/TVCP/TMCP/TPCL/TCIJ/TCIM) and when to use each
  • Benchmarks — packPNG vs precomp and xz, with numbers
  • Library — libpackPNG (the C API)
  • Building — build from source

byte-exact round-trip is verified on 162/162 PngSuite images, the real corpus, and across Linux ↔ Windows.

Clone this wiki locally