C++17 · Zero dependencies
A zero-dependency C++17 image-compression and media-container library. JPEG and PNG codecs written from scratch, metadata stripping at the byte level, quality-preserving resize, and MP4/MOV container rewriting — nothing beyond the C++17 standard library.
lightpress was born from a real constraint: iMessage Exporter Redux needed to compress exported attachments before archiving them, but pulling in libjpeg, libpng, and an ffmpeg dependency tree for that would have bloated a tool meant to ship as a single clean binary. So I wrote the codec instead — portable C++17, no external libraries, fully under my control.
| Capability | Details |
|---|---|
| JPEG encode | AAN fast DCT, BT.601 YCbCr, 4:2:0 chroma subsampling, IJG quality scaling, standard Huffman tables, JFIF container |
| JPEG decode | Baseline decoder for roundtrip testing and SSIM calculation |
| PNG encode | Optimal per-scanline filter selection, DEFLATE with fixed Huffman, CRC32, full IHDR/IDAT/IEND chunking |
| PNG decode | Filter reversal + inflate; RGB, RGBA and grayscale (color types 0/2/6) |
| EXIF strip | Removes APP1 (EXIF/XMP), APP2 (ICC), APP13 (IPTC) from JPEG at the marker level — no re-encode, no quality loss |
| Resize | Nearest-neighbour, bilinear, and bicubic (Mitchell–Netravali) with sRGB linearization |
| MP4 / MOV strip | Walks the MPEG-4 Part 12 atom tree, removes udta/meta/cover-art atoms, and rewrites size fields |
Part of building good systems software is being precise about what it doesn't do. lightpress says so in its own README:
A from-scratch codec is only useful if its output is genuinely good. lightpress uses SSIM (structural similarity) to benchmark its encodes against ffmpeg baselines, with a built-in decoder so every encode can be measured on roundtrip. The test suite runs under CTest.
cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure
← Back to all projects