CLI tool
oxipng/oxipng avatar
oxipng/oxipng

Oxipng's alpha flag is lossy and its page says so

Multithreaded PNG optimizer written in Rust

4,330 stars169 forksRustMIT

At a glance

What is it?
Oxipng is a multithreaded lossless PNG optimizer written in Rust, and its readme is unusually candid about the edges of that claim: the alpha pass technically changes pixel values, higher optimization levels are not guaranteed to produce smaller files, animated PNG support is partial, and migrating from the project it rewrote is not a drop-in change. The repository also disagrees with itself about the minimum supported Rust version.
Who is it for?
Oxipng fits a build pipeline that already produces lossless PNGs and wants them smaller without changing what they display, and the safe metadata stripping mode gives you that guarantee while the alpha pass is the one to think twice about. It does not fit someone optimising animated PNGs, since the page recommends another tool first, and it does not fit someone porting an OptiPNG command line by assumption, because the page says it is not a drop-in replacement.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 8 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 21, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • oxipng/oxipng4,330 ★ · +88
Star history
Repository2026-09-282026-11-21
oxipng/oxipng4.2k4.3k

88 Stars in the last 54 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The readme and the manifest disagree about the minimum Rust version

The installing section states the current minimum supported Rust version as 1.85.1.

The package manifest says 1.88.0 in the field Cargo uses to enforce exactly that.

The container build pins a third number, a Rust 1.98 Alpine image, referenced by digest so it cannot move under you.

For a library, the manifest field is the one that matters mechanically: it is what stops a consumer's toolchain from building against features they do not have. The readme number is prose, and prose drifts.

So the practical answer to what version you need is 1.88.0, and the discrepancy is a documentation bug worth reporting rather than reasoning about. It is also a decent illustration of why a project that publishes both a binary and a library keeps the enforcement in the manifest.

Higher levels are not strictly better, and the page admits it

The optimization level runs from 0 through 6, or the maximum, with lower being faster and higher compressing better. The default is 2, described as quite fast with good compression, and higher levels as notably better but with increasingly diminishing returns.

Then there is a footnote, and it is the most useful thing on the page.

Oxipng is not a brute-force optimizer. Higher levels are almost always better than or equal to lower ones, but that is not guaranteed, and in rare circumstances a lower level can produce a marginally smaller output. The same caveat is attached to the optional Zopfli compression mode: it is not guaranteed to always beat the default compression.

That is an unusual admission. Most compressors claim monotonic improvement, because it is almost true, and this one says out loud where almost is not enough.

For a build pipeline the consequence is that the level is a policy choice, not a maximum to be pushed.

Two of the common options change pixels and one does not

The three options the page explains are often discussed as if they were the same kind of switch, and they are not. The example it opens with combines all three over a set of files:

code
oxipng -o 4 --strip safe --alpha *.png

Stripping metadata is the safe one. In safe mode it removes only metadata that will never affect rendering. In the other mode it removes all metadata that is not critical to the image. You can also pass a comma separated list of specific metadata chunks, and a short form stands for the safe mode.

Alpha optimization is different. It improves compression of images with transparency by altering the color values of fully transparent pixels. The page calls it generally recommended, then says it is technically a lossy transformation and may be unsuitable for some specific applications.

So one option provably cannot change what you see, and the other changes stored values in pixels that render as nothing. The tool is called lossless and both statements are true.

One more detail worth internalising: short options can be grouped, so a six character string is equivalent to five long options spelled out, and every option is case sensitive.

Animated PNGs get partial support and another tool recommended first

The section on animated PNGs is three sentences and an apology.

Oxipng currently supports only limited optimization of animated images. It can perform alpha optimization, refiltering and recompression across all frames, but all transformations will be disabled.

For best results it recommends using another tool, with a link to a dedicated APNG optimizer, before running Oxipng.

That is the whole story: alpha optimization, refiltering and recompression happen across frames, other transformations are disabled, and the page sends you elsewhere to finish the job.

If your pipeline handles animated PNGs, the practical sequence is the other tool first and Oxipng second.

The binary feature is why library users have to name their features

The feature list in the manifest is the real dependency documentation, and the library guidance depends on it.

There is a binary feature, which pulls in the command line argument parser, a logging initialiser, a size parser and a glob library that is only compiled on Windows. There is a parallel feature, which pulls in the work-stealing thread pool. There is a zopfli feature, which pulls the extra compression implementation. The default set is all three.

The library section says you should disable the binary feature, and then admits there is no simple way to disable one feature, so you have to turn off default features and name the ones you want. The example that follows turns off the defaults and lists three features, two of which are the multithreading and the slow compressor.

So a library user who does this correctly gets the project's founding feature back by name, and one who does it carelessly gets a single threaded compressor. That is a sharp edge for a dependency, and it is documented.

A scratch image holding one verified cross-built binary

The container build is unusually careful, and the details are worth reading as intent.

The Dockerfile begins with a syntax directive and a build check directive that treats lint failures as errors. It then uses a cross-compilation helper image referenced by digest, and a Rust Alpine image referenced by digest, installs a compiler toolchain, and copies the helper in. The target platform is read as a build argument.

The compile step mounts caches for the Cargo git database, the registry cache and the registry index, so repeated builds do not re-download the world. Then it builds in release mode for the target, and runs a verification step on the built binary before copying it aside.

The final image starts from scratch. There is no shell, no package manager and no libc in it, just the binary and a set of standard image labels, with the binary as the entrypoint and help as the default command.

That last choice is why the documented way to use the image mounts your working directory and passes a file path inside it.

A rewrite from 2015 that is not a drop-in replacement

The history section is short and honest about what this project is.

Oxipng began in 2015 as a rewrite of the OptiPNG project. The core goal was multithreading, which would have been very difficult inside OptiPNG's existing C codebase, and the rewrite was also a chance to choose a more modern, safer language.

Then it says what that history does not buy you. The project has evolved considerably since, some options remain similar to OptiPNG, but the architecture and capabilities are now quite different, and it is not a drop-in replacement. If you are migrating, check the help before use.

The tree supports that: a manual file holding the long help, a change log, a security document, benchmark files including one named for the slow compressor, a task directory for build automation, and the hook manifest that the pre-commit integration references.

The hook example pins a release from an earlier line than the current one, which is normal for documentation and another reason to read the version list rather than the sample.

Editorial conclusion

Oxipng fits a build pipeline that already produces lossless PNGs and wants them smaller without changing what they display, and the safe metadata stripping mode gives you that guarantee while the alpha pass is the one to think twice about. It does not fit someone optimising animated PNGs, since the page recommends another tool first, and it does not fit someone porting an OptiPNG command line by assumption, because the page says it is not a drop-in replacement. Before adopting, check four things. Whether your images can tolerate the alpha pass, because altering fully transparent pixels changes data and the page warns it may be unsuitable for specific applications. Which optimization level you standardise on, given higher levels have diminishing returns and are not strictly monotonic. What the minimum Rust version actually is, because the readme and the package manifest disagree and the container build pins a newer toolchain than both. And how you invoke it from a library, because disabling the default features to drop the command line front end also removes multithreading unless you ask for it back by name.

Frequently asked questions

What is oxipng?

A multithreaded lossless PNG and APNG compression optimizer written in Rust, usable from a command line or as a library inside other Rust programs. It began in 2015 as a rewrite of the OptiPNG project and follows semantic versioning, with the newest release recorded as 10.2.1.

How do I install oxipng?

From Cargo with cargo install oxipng, or by building from source with cargo build --release and copying the binary. On macOS and Linux the page recommends your distribution's package repository if the version there is not too outdated, Windows binaries come from the releases section, and a container image is published for both Linux architectures.

How do I use oxipng?

Run it over PNG files with an optimization level, a metadata strip mode and optionally alpha optimization; the example on the page combines level four, safe stripping and alpha. Short options can be grouped into one string, all options are case-sensitive, and the full list lives in the help output or the manual file in the repository.

Official sources

  1. Issues
  2. License: MIT
  3. oxipng/oxipng on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/oxipng-oxipng.svg)](https://hysenlabs.com/projects/oxipng-oxipng)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/oxipng-oxipng.svg)](https://hysenlabs.com/projects/oxipng-oxipng)

Was this useful?