Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
This branch is 519 commits ahead, 44 commits behind google:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Zopfli in Rust

This is a reimplementation of the Zopfli compression tool in Rust.

If you're looking for the maintained repo of the Rust Zopfli implementation, please go to

I started the Rust implementation as an experiment in incrementally rewriting a C library in Rust, keeping the project compiling at every step. For more information about that experiment, see the slides for a talk she gave about it.

This repo is now archived for historical context for the rewrite experiment and the talk. Please file all issues and pull requests on

How to build

To build the code, run:

$ cargo build --release

and the executable will be in target/release/zopfli.

This should work on stable or beta Rust.

You can also run make zopfli, which will run cargo build and then symlink target/release/zopfli to just zopfli in the project root; this is what the C library does and it was useful for scripting purposes during the rewrite process to keep the command and resulting artifacts the same.

Running the tests

There are some unit tests, mostly around the boundary package merge algorithm implementation in, that can be run with:

$ cargo test

Golden master tests, to check that compressed files are exactly the same as the C implementation would generate, can be run using:

$ ./test/

and then checking that git reports no changes to the files in test/results.

Or you can run make test, which will run cargo test, then ./test/, and then will fail if there are any changed files according to git. Note that if you have uncommitted changes and you run this, your changes will cause this command to fail, but the tests actually passed.


A Rust implementation of the Zopfli compression algorithm.







No packages published


  • Rust 97.9%
  • Shell 1.3%
  • Makefile 0.8%