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 AVIF support to resize_image() #1347
base: next
Are you sure you want to change the base?
Conversation
Apologies for the duplicate PRs. Looks like when I first created my avif branch I accidentally based it on master, rather than new. Should all be clean now hopefully. |
I have been doing some tests on quality vs filesize for AVIF files, and it looks like somewhere in the region of quality 50 would be a more sensible default value for AVIF to roughly correlate to jpeg at 75. I could not get any SSIM analysis tools to work on my machine with AVIF, or losslessly convert my generated AVIF files to something like png, so this comparison was done by eyeballing images and is rather unscientific. If someone else can manage to get a proper test setup sorted, I would be very interested to know what their thoughts are regarding a sensible default quality level. I don't think we should have the same default level for jpeg and avif as the scales really are not comparable and could put people off using the new format (as AVIF at 75 is often bigger than even baseline jpeg, though of course higher quality), but would be interested to hear other people's thoughts on the matter. Another interesting side effect of my tests was me realising just how good mozjpeg is at retaining quality at smaller filesizes while still retaining good compression speed. AVIF does seem to outperform it in terms of quality vs filesize, but takes much longer to compress. |
It looks like it doesn't compile on any of the platforms we support due to the nasm version required though... |
That's a bit of a pain. I'm working on Fedora here, so didn't notice as they usually ship pretty up to date versions of packages. Shall we have to shelve this one for now then? |
I think it would be better to wait a bit yes, even mac and windows are failing on CI which means most users will encounter the same issue when building from source. |
Hi! I was going through this pull request and thought I could perhaps locally merge it with the latest commit to have I noticed that zola/components/imageproc/src/lib.rs Lines 19 to 22 in 2fff0c2
zola/components/imageproc/src/lib.rs Lines 19 to 22 in fc808f2
|
We need easy support on all 3 platforms. If it can be disabled as per the issue then we could enable it on linux if it's |
Oh, no, I wasn't implying that @Keats, as that seems troublesome. I was looking into getting it to work locally for that reason. I noticed |
Oh it's probably just a merge issue. Webp is still supported |
1e55db1
to
3155662
Compare
Ubuntu 22.04 is out now, does this resolve the previous version issue? AVIF is really nice! |
IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.
The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.
Sanity check:
Code changes
(Delete or ignore this section for documentation changes)
next
branch?If the change is a new feature or adding to/changing an existing one:
This pr adds support for AVIF images to the
resize_image()
function, closing #1202. Asimage
does not currently allow setting the speed and quality parameters via thewrite_to()
method this manually creates an encoder and writes the result out to a file.There are 2 caveats to this implementation:
speed
parameter is hardcoded. This currently uses the same default as thecavif-rs
crate (whichimage
uses for avif encoding). This encoding speed can be very slow, so it might be nice to allow changing this. I did not add it as another argument toresize_image()
as I felt it would start to get unwieldy. Perhaps eventually this could be overriden inconfig.toml
?