返回资讯中心
外部精选
软件工程
#开发者实时流

Pngdeer – a Rust PNG compression library that rivals TinyPNG

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 metri…

Hacker News 最新luin2026/10/26 · 今天7 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

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.

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

Picks the quality for you: about what TinyPNG would give the image, never above 90 on SSIMULACRA2's scale, which is indistinguishable at 1:1.

Same bytes everywhere: the command line (macOS and Linux) and the browser (WebAssembly, on every core) run the same Rust code and write identical files.

Big images too: up to 40 megapixels in the browser, more on the command line.

Free and open source: MIT.

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):

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

Searches the palette: palette sizes from 2 to 256 colors, each tried a few ways (with and without Floyd–Steinberg dithering, with neighbour smoothing, with a second palette builder), and the smallest file that reaches the target wins.

Scores what you'd see: SSIMULACRA2, measured in-process. Colors are matched in Oklab, smooth gradients are always dithered, and transparent pixels are judged over light and dark backgrounds.

Stays fast on big images: large images are searched on a downscaled preview and checked at full size.

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

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.

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).

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →