oxipng

Multithreaded lossless PNG and APNG optimizer, usable as a CLI or a Rust library.

Tool
Cargo
v10.2.0
4,172stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
81/100Excellent
Development Activity84
Maintenance84
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality78
Innovation78
Learning Curve76

oxipng is a multithreaded lossless PNG/APNG compression optimizer written in Rust. It began as a rewrite of OptiPNG focused on multithreading and has since grown its own architecture. It can be run as a fast command-line utility or embedded as a Rust library, applying filtering, recompression (including optional Zopfli), alpha optimization, and metadata stripping to shrink PNGs without any quality loss.

What You Get

  • A fast oxipng command-line utility with optimization levels from -o 0 to -o max
  • A Rust library API centered on an Options struct and an optimize function
  • Lossless filtering and recompression, with optional Zopfli for maximum compression
  • Metadata stripping (safe/all) and alpha optimization for transparent images

Common Use Cases

  • Optimizing PNG assets for the web to cut page weight
  • Running lossless image compression as a pre-commit hook or CI step
  • Embedding PNG optimization inside a larger Rust image-processing pipeline

Under The Hood

Architecture — The crate exposes a library (src/lib.rs) and a CLI binary (src/main.rs, behind the binary feature). The public flow is an Options struct passed to optimize, which reads a PNG, evaluates filter and compression strategies in parallel, and writes the smallest lossless result. Deflate work can use the standard backend or an optional Zopfli path; alpha optimization and metadata stripping are configurable passes.

Tech Stack — Rust 2024 edition (MSRV 1.85.1). It uses a multithreaded design for the optimization trials, with optional feature flags for zopfli, parallel, and filetime. A Dockerfile publishes multi-arch images, and an xtask crate handles repo automation.

Code Quality — The project is actively developed with 80 releases, a documented MSRV, a SECURITY.md, and a tests/ directory plus benches/. The README explicitly advises disabling the binary feature for library use, showing attention to how the crate is consumed in both modes.

API Design — As a CLI the options are discoverable and combinable (short flags like -savvo6 expand to full options); as a library the single Options + optimize entry point keeps embedding simple. Feature flags let library users trim unused CLI dependencies cleanly.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search