Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Expose compression and filter PNG options through savefig #5397

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

Closed
mdboom opened this issue Nov 4, 2015 · 8 comments · Fixed by #13207
Closed

Expose compression and filter PNG options through savefig #5397

mdboom opened this issue Nov 4, 2015 · 8 comments · Fixed by #13207
Milestone

Comments

@mdboom
Copy link
Member

mdboom commented Nov 4, 2015

As a follow-on to #5389.

JPG saving already has some JPG-specific options. We just need to follow that pattern again for PNG.

@tacaswell tacaswell modified the milestone: proposed next point release (2.1) Nov 5, 2015
@inviridi
Copy link

Would be very useful indeed to trade off file size and image quality before the export.

@anntzer
Copy link
Contributor

anntzer commented Sep 29, 2017

I think file size optimization should remain the realm of tools such as pngcrush and optipng.

@inviridi
Copy link

inviridi commented Oct 1, 2017

Definitely see your point, @anntzer - do one thing and do it well - but MPL is such a feature-rich tool that it would be a pity to miss this. Otherwise, let's get rid of the JPG options and the animation support. People can stitch their animations together by hand, too. Actually, who needs JPG anyway? Users could convert it from PNG...

@anntzer
Copy link
Contributor

anntzer commented Oct 1, 2017

Good luck stitching animations by hand. To get any reasonable performance you need to pipe the raw buffers to the encoder... which can be done, but is far from trivial. Similarly (though less so) for jpeg.
OTOH if you really care about your png file size, the optimization size is going to be by far the slowest, so it's fine just to rely on an external tool.

Still, I didn't say I would veto a PR implementing this...

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 1, 2017
@tacaswell
Copy link
Member

Please keep the comments here civil and avoid sarcasm.

This is reasonable feature to want, but given that it can be handled via external tools is not the highest priority (as you can infer that this is ~2 years old).

@eggsperde I would be happy to review a PR adding this feature.

@inviridi
Copy link

inviridi commented Oct 1, 2017

No offense/sarcasm taken!

It seems that PNG only has one compression variable ("speed/compression ratio"). The resulting image is always lossless. For more compression we'd have to look to external programs. I honestly thought there would be more to it.

I am currently in the final stretch of writing a thesis, but would like to give this a shot once I have a real life again.

@tacaswell
Copy link
Member

@eggsperde Best of luck finishing the thesis!

@philmaweb
Copy link

any progress towards this feature request?

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

Successfully merging a pull request may close this issue.

6 participants