-
Notifications
You must be signed in to change notification settings - Fork 972
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: Add AVIF support. #1202
Comments
As of image v0.23.12 there is now an |
Maybe this will be useful/helpful: |
That's the very crate |
I was thinking about the following feature. It very likely should be filed as an idea to Kornel, the cavif-rs author.
When converting files for the web, we very likely need multiple sizes. It would be useful to be able to pass a list/array of resolutions to the convert call.
Here is a rough example:
1. image.jpg is 4000x4000 pixels,
2. We need it in 3 different resolutions,
3. A possible parameter would be: "3000x3000, 2000x2000, 1000x1000"
We could split it by a comma or use a different separator. The individual resolutions use an x as a separator as all the libraries tend to do. Placing a 0 (zero) after the x would mean to keep the height propotional or the other way around if the first part to the left from x would be 0 (zero).
I guesss that once we have the bit stream for the original image we can use it to generate different resolutions or not - I'm not the expert in such matters.
Obviously this batch size creation would be very beneficial for jpeg resizing as well.
|
I already asked for resizing to be supported, and kornel said no, you should use ImageMagick instead: kornelski/cavif-rs#7 I don't know if there is some ImageMagick equivalent written in Rust, but finding or creating such a thing with support for AVIF may be worthwhile. |
As far as I am aware the resizing and encoding stages are separate in the
As soon as avif is added it should be possible to add an additional |
As far as I am aware the resizing and encoding stages are separate in the image-rs crate. Zola's resize_image() function will load the source image, resize it, and then re-encode to whatever format you specify.
Keeping in mind what I cited above we should keep in mind that avif compression is quite demanding and takes much more time than resizing a jpg file or encoding to webp.
That is why I was thinking if it would be possible to encode the original image and then resize it to different dimensions from that encoded source.
|
I'm not sure that would be possible? As avif, jpeg and png etc are just ways of compressing the raw bitmap data, the image needs to be decoded back to raw data before it can be resized. Any transforms are then made upon the uncompressed image and would need to be re-encoded back to avif before saving. If you took a source image and resized it to 3 different sizes, each one of those new images would have to be encoded separately. I could be totally wrong on this, as I know fliff had a similar feature where it was encoded in such a way that each slice of the image could be used to construct a smaller variant, but I don't think avif supports any form of progressive encoding. |
Adding this as a feature request now as image-rs seem to be well advanced with their avif support: image-rs/image#1152
The original forum thread for reference: https://zola.discourse.group/t/feature-request-add-support-for-avif-images-to-resize-image/538
I don't have much development time at the moment due to real life, but happy to take a crack at this at a later date if no one else has claimed it.
The text was updated successfully, but these errors were encountered: