Skip to content
YadeWira edited this page Nov 7, 2026 · 13 revisions

PJA

PJA (packJPG Algorithm) recompresses JPEG, JPEG-LS and JPEG 2000 files without loss: a photo shrinks by about a quarter, a JPEG 2000 codestream by about 8% (HTJ2K 11%, scanned 1-bit pages 70%), and pja x gives back the original byte for byte. It is written in FreePascal, with the coefficient model's core in C and some x86-64 assembly, and no libraries; it runs on Linux, macOS and Windows (XP and later). PJA is the successor of packJPG: a new codec and format of its own, not compatible with .pjg.

pja a photo.jpg          # -> photo.pja, about 27% smaller
pja x photo.pja          # -> photo.jpg, the same file byte for byte

Nothing is written under an output's name unless it verified: a decompresses its own result and compares it with the input first, and x checks the size and the BLAKE3 hash the .pja carries.

The family

PJA belongs to a family of recompressors that share that rule.

Sibling Formats Successor of
PMPA MPEG audio (MP1, MP2, MP3) packMP3, packMP2
PRA raster images (PNM, BMP, TIFF, PSD, HDR, ...) packPNM
PPA the PNG family (PNG, APNG, MNG, JNG) packPNG
PAIA animated images (GIF, WebP, FLI/FLC, ANI, ...) (new)
PJA JPEG, JPEG-LS and JPEG 2000 packJPG

Pages

The repository's own documents go deeper: CLI.md (the command), CODEC.md (the codec, everything measured and tried), FORMAT.md (the .pja file) and POLICY.md.

The formats are stable since 0.9.0: what is fixed, and what may still come, is in doc/STABILITY.md.

Clone this wiki locally