pngtastic
pngtastic copied to clipboard
PngOptimization with pre-selected filtering
Hi Ray,
I have an application that dynamically generates PNGs.
I did some analysis of the types of images we create and found that for my test data, no filtering (PngFilterType.NONE
) always resulted in the best file size. (If it helps, we are generating transparent images with relatively sparse content and few colors).
Knowing this, it seems I should be able to dramatically cut the processing time by instructing PngOptimizer
to use a preferred approach.
I made a quick attempt yesterday and my microbenchmark showed I was able to speed up optimization by 6-7x for my case by specifying a filter and skipping adaptive filtering:
https://github.com/ianpojman/pngtastic/commit/efed346ef833e6a1283299bcfe8d636195532325
What do you think about this approach? In your mind does it make more sense for me to write my own variant of PngOptimizer more tailored to my use case?
thanks Ian
Nice! I know it's pretty much brute force right now, but by trying every filter you're sure you end up with the best one. I'm totally open to providing an option to override that if you need to optimize for speed.
Just fyi, I'm away on vacation for the next 10 days, but will be around after that.
Nice I'll throw together a pr. Thanks for releasing the other fix so quickly and have a good vacation