#compression

bin+lib zopfli

A Rust implementation of the Zopfli compression algorithm

11 releases

Uses old Rust 2015

0.4.0 Dec 7, 2018
0.3.7 Mar 3, 2018
0.3.6 Jun 4, 2017
0.3.5 Jan 18, 2017
0.1.0 Mar 9, 2016

#101 in Compression

Download history 2274/week @ 2021-08-08 2571/week @ 2021-08-15 3125/week @ 2021-08-22 2922/week @ 2021-08-29 3129/week @ 2021-09-05 3679/week @ 2021-09-12 3315/week @ 2021-09-19 2895/week @ 2021-09-26 3542/week @ 2021-10-03 3398/week @ 2021-10-10 3913/week @ 2021-10-17 3499/week @ 2021-10-24 3453/week @ 2021-10-31 3003/week @ 2021-11-07 3349/week @ 2021-11-14 2961/week @ 2021-11-21

9,020 downloads per month
Used in 8 crates (6 directly)

Apache-2.0

130KB
2.5K SLoC

Zopfli in Rust

Build Status

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

I have totally ignored zopflipng.

More info about why and how I did this can be found in the slides for a talk I gave about it.

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 katajainen.rs, 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/run.sh

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/run.sh, 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.

Dependencies

~180KB

) \