kornelski / cavif-rs

AVIF image creator in pure Rust
https://lib.rs/cavif
BSD 3-Clause "New" or "Revised" License
570 stars 27 forks source link

resize images #7

Closed skyfaller closed 3 years ago

skyfaller commented 3 years ago

I have an original JPEG, and a bunch of resized JPEGs at q75 (720px wide, 1080px wide, etc.). I would like to make these into identically sized AVIFs, but it seems to me that I won't get as good results if I turn the lower-quality JPEGs into AVIFs. I would expect the best results would come from resizing the original JPEG and converting those into AVIFs of different sizes, or converting the original to AVIF and then resizing that.

First, is resizing supported in cavif? If not, is this a desirable feature that could be added?

Second, if that is out of scope for cavif, how would you go about doing this on the command line? What tools would you use? Apologies if this is the wrong place to ask.

kornelski commented 3 years ago

You're right that 1:1 conversion between lossy formats isn't ideal. It wouldn't be too hard to add most basic scaling, but I'm afraid it will just lead to requests for more resizing options, filtering modes, cropping, etc. until it becomes ImageMagick. So I suggest use ImageMagick:

convert image.jpg -resample 25% PNG:- | cavif - > image.avif