-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add compression level #488
base: master
Are you sure you want to change the base?
Conversation
fc7774e
to
697e160
Compare
Could you say a bit about why you want this functionality? One weird aspect of this PR is that Lines 696 to 697 in 2cfde02
Another complication is that |
Apologies for the short PR description it was a bit late for me when I opened it.
I'm building a Wasm package for compressing PNG, mostly canvas-generated PNG images which lack compression. And for my specific case, QR Images, Also wanted to give users a more familiar compression setting, most libs (libvips, ImageMagick) I've used for handling images usually have a PNG compression level between 0-9
I'm currently building it myself with this patch applied, but thought that others may need this feature as well. So in my specific case I don't mind waiting for the next breaking release. |
I also need this for the drop-in replacement for |
Could we instead add this as a new method on the encoder, like |
I would also like this option, since the "Best" compression level in this crate, according to it's docs, does not actually use maximum compression, and there are no other variants that are higher either: /// Higher compression level
///
/// Best in this context isn't actually the highest possible level
/// the encoder can do, but is meant to emulate the `Best` setting in the `Flate2`
/// library.
Best, |
This PR adds
Compression::Level(u32)
to allow finer control over compression settings. It maps directly toflate2::Compression::new(level)
.