Oxipng shrinks PNG and APNG files without changing visible image content. It runs as a command-line tool or as a Rust library dependency.
Overview
Oxipng is a lossless optimizer for PNG and animated PNG (APNG) files. It refilters and recompresses images so files weigh less while pixels stay the same, and it uses multithreading to work through batches faster than single-threaded tools.
From the command line you pick optimization strength from level 0 through 6 or max, strip metadata with safe or all modes, and optionally adjust alpha handling for transparent images. Short flags can be combined in one invocation, and help output lists more advanced switches.
Distributors ship binaries through package managers and Cargo on Linux and macOS, with Windows builds on the release page. A container image at ghcr.io/oxipng/oxipng targets linux/amd64 and linux/arm64. You can hook the binary into git workflows through pre-commit, and Rust projects can depend on the library and call optimize with an Options struct when the binary feature is disabled.
APNG handling is partial: alpha optimization, refiltering, and recompression run on frames, but other frame transforms stay off, and the project suggests running a dedicated APNG tool first when you need deeper animated optimizations. The code started as a fresh take on OptiPNG multithreading goals and is not marketed as a direct drop-in replacement for that tool.
Key features
- Multithreaded lossless PNG compression
- Configurable optimization levels 0 through max
- Metadata stripping safe or all modes
- Optional alpha compression for transparency
- Docker image for amd64 and arm64 Linux
- Rust library API for programmatic use
- Limited APNG optimization support
- pre-commit integration for PNG checks
Use cases
- Shrinking PNG assets for websites
- Batch optimizing image folders in CI
- Embedding PNG optimization in Rust programs
- Running optimizers inside Docker pipelines