Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PngOptimization with pre-selected filtering #11

Open
ianpojman opened this issue May 26, 2017 · 2 comments
Open

PngOptimization with pre-selected filtering #11

ianpojman opened this issue May 26, 2017 · 2 comments

Comments

@ianpojman
Copy link

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:

ianpojman@efed346

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

@depsypher
Copy link
Owner

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.

@ianpojman
Copy link
Author

Nice I'll throw together a pr. Thanks for releasing the other fix so quickly and have a good vacation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants