pixo
A minimal-dependency, high-performance image compression library written in Rust.
This is a work-in-progress and exploration of coding agents.
Features
- Zero runtime dependencies — All encoding algorithms implemented from scratch
- Entirely in Rust — No C or C++ codecs required
- PNG and JPEG support — Lossless PNG, lossy PNG (quantization), and lossy JPEG
- Small WASM binary — 142 KB with competitive compression (benchmarks)
- Well-tested — 79% code coverage, 502 tests (codebase comparison)
Usage
- Playground (recommended) — Try it in your browser
- WASM — Use in browser or Node.js applications
- CLI — Compress images from the command line
- Rust Crate — Use as a library in your Rust projects
Documentation
Comprehensive guides explaining the algorithms and compression strategies:
- Documentation Index — Start here for an overview
- Introduction to Image Compression — Why and how we compress images
- Introduction to Rust — Rust features through the lens of pixo
Core Algorithms
- Huffman Coding — Variable-length codes based on symbol frequency
- LZ77 Compression — Dictionary-based compression with sliding windows
- DEFLATE Algorithm — How LZ77 and Huffman combine
Image Formats
- PNG Encoding — Lossless compression with predictive filtering
- JPEG Encoding — Lossy compression pipeline
- Discrete Cosine Transform — The mathematical heart of JPEG
- Quantization — How JPEG achieves compression