Hacker News new | ask | show | jobs
by mattdesl 456 days ago
Last time I benchmarked png-tools, it was about 2-6x faster than fast-png for encoding.

https://github.com/mattdesl/png-tools

I’ve also added some other features like multi-threaded encoding, cancellation, encoding physical dimensions, color profiles, all of which is useful for encoding large print-ready PNGs on the client.

(No shade against fast-png, it’s a good library, but maybe not the fastest!)

1 comments

Interesting you default to paeth.

Only working on grayscale 16bit images with only the lower 10bits populated I never found it reduced image size. But I was doing per scan adaptive filtering so maybe if I was only allowed one filter for the entire image that would be it?

Just wondering if you did any experiments with different filter strategies?

I think in the inputs I tested, I found Paeth to be the best for lower file sizes. I haven’t tested it extensively and to be honest, I should probably include some easier API for per-scanline filter selection rather than just a global choice. It should be possible right now with the lower level functions the library exposes, but not as easy.