slimdeer README

The project's README from github.com/heydeer/slimdeer. As one markdown file: README.md.

pngdeer

Smaller PNGs. Same picture. pngdeer is a lossy PNG compressor with no quality slider: for each image it searches palette sizes from 2 to 256 colors, with and without dithering, scores each result with a perceptual metric, and keeps the smallest file that still looks right. At the same quality, the median image comes out 8–12% smaller than with TinyPNG, the best result of any open-source compressor we've measured.

Try it in your browser → Nothing is uploaded: images are compressed on your device.

pngdeer in the browser

brew install heydeer/tap/pngdeer
pngdeer input.png -o output.png

Leaderboard

We ran pngdeer, TinyPNG and eight open-source quantizers on 180 PNGs: icons, UI screenshots, illustrations, photos, cut-outs and 3D renders. Every output was scored against its original with SSIMULACRA2, a perceptual metric where 90 means indistinguishable at 1:1. TinyPNG is the yardstick:

Each cell gives the held-out set (71 images) / the tuning set (109 images):

Compressor Points Reaches
pngdeer +1.7 / +2.0 67 / 106
TinyPNG (the yardstick) 0 71 / 109
pngquant 0.0 / +0.3 53 / 87
quantizr −0.1 / −1.0 39 / 53
exoquant −3.7 / −5.1 19 / 24
NeuQuant −6.5 / −9.8 4 / 5
FFmpeg −7.0 / −8.8 16 / 15
quantette −7.6 / −9.6 18 / 21
ImageMagick −11.3 / −14.5 3 / 8
Pillow −16.8 / −19.5 4 / 4

At TinyPNG's quality, pngdeer's files are 12% smaller on the held-out set and 8% smaller on the tuning set (median image).

How it works

The research notes follow every step, from the first comparison with TinyPNG to today's defaults.

Command line

pngdeer input.png -o output.png              # automatic quality
pngdeer input.png -o output.png --target 85  # a fixed SSIMULACRA2 quality
pngdeer --help

From source: cargo build --release, and the binary is target/release/pngdeer.

Browser

The web app runs the same code compiled to WebAssembly. To run it locally (web/build.sh lists the toolchain it needs):

sh web/build.sh
python3 web/serve.py   # http://localhost:8770

License

MIT. Dependencies keep their own licenses (web/THIRD_PARTY_LICENSES.txt), as do the test and sample images (the SOURCES.md next to them).

slimdeer (heydeer/slimdeer)

Searching Database…

What is this?pngdeer is a lossy PNG compressor that automatically searches palette sizes from 2 to 256 colors and dithering options, scoring each result with a perceptual metric (SSIMULACRA2), then keeps the smallest file that still looks right. There's no quality slider to set yourself.
Is this a command-line tool, a browser app, or both?Both. The same Rust code runs as a native CLI binary on macOS and Linux and is also compiled to WebAssembly for the in-browser version, producing identical output files.
How do I get it running?Build the CLI from source with 'cargo build --release'; the binary ends up at target/release/pngdeer. The browser app can be used directly online or run locally using the toolchain listed in web/build.sh.
Do I need Rust installed to use it?To build the CLI from source you need Rust and Cargo, since the README only describes a source build. The browser version needs nothing beyond a browser, since it ships as WebAssembly.
Can I set the compression quality myself?No, there's no quality slider: pngdeer always targets roughly what TinyPNG would produce for that image, capped at 90 on the SSIMULACRA2 scale, so you can't dial it higher or lower.
Does the command-line tool run on Windows too?The README only lists macOS and Linux for the CLI build; Windows isn't mentioned, so the browser (WebAssembly) version is the way to use pngdeer there.
Does the browser version upload my images anywhere?No, images are compressed entirely on your device; nothing is sent to a server.
How much smaller are the files compared to TinyPNG?On a 180-image benchmark, pngdeer's files are 8-12% smaller than TinyPNG's at matching quality for the median image, and still 6-9% smaller when checked with a different metric (butteraugli) that the search never looks at.
How does pngdeer pick a palette instead of using a fixed setting?For each image it tries palette sizes from 2 to 256 colors, with and without Floyd-Steinberg dithering and a couple of other variants, scores every candidate with SSIMULACRA2 in Oklab color space, and keeps the smallest file that still meets the quality bar.
How does it stay fast on large images?It runs the palette search on a downscaled preview and only checks the chosen settings at full size. The browser version handles images up to 40 megapixels; the CLI can go higher.
Creator
heydeer
Size
77.6 MB
Stars
473
Updated
CommitNov 04
Age
10d
Commits · 90 Days