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

[Feature Request] Enabling uncompressed PNG support #349

Open
BlueSwordM opened this issue Aug 2, 2022 · 3 comments
Open

[Feature Request] Enabling uncompressed PNG support #349

BlueSwordM opened this issue Aug 2, 2022 · 3 comments

Comments

@BlueSwordM
Copy link

BlueSwordM commented Aug 2, 2022

Currently, image provides support for many PNG compression levels, all the way from Fast, Best, Huffman, and RLE.

However, according to the PNG specification, it is possible to store only uncompressed deflate blocks.

While this would be a niche feature addition, it would be very useful for scenarios where the highest encoding speed is required, as the encoding speed of uncompressed PNGs is obviously the highest among all other settings, and unlike PPM, we get greater compatibility with general software with it.

It shouldn't be too hard to add it to image's PNG implementation, so hopefully it won't take too much time to do so.

Summary of feature request: Enabling/Implementing uncompressed PNG support for maximum encoding/decoding speed.

Example program of something that would heavily benefit from this:
https://github.com/shssoichiro/butter-video

@fintelia fintelia transferred this issue from image-rs/image Aug 3, 2022
@fintelia
Copy link
Contributor

fintelia commented Aug 3, 2022

Migrating to image-png because this is exactly the kind of feature that our format-specific crates are suited to handle...

Looking into this, it seems that the blocker is that the deflate crate doesn't current support this feature. However, flate2 does support it, and there is interest in switching over to using it (because deflate is in maintenance mode).

@BlueSwordM
Copy link
Author

Oh, I completely forgot there are multiple format specific crates. Thanks for the tip.

And yeah, a PR to enable flate2 utilization replacing the current deflate crate seems like a good idea.

@fintelia
Copy link
Contributor

We've now switched to fdeflate for fast compression, which does support writing uncompressed data. At the moment that's only used as a fallback if normal fast compression isn't able to shrink the data. But I'd be open to accepting a PR exposing it as a user facing feature if it turns out to be significantly faster than our existing "Fast" compression

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