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

Support AVIF format #238

Open
Maxou44 opened this issue Jul 3, 2020 · 10 comments
Open

Support AVIF format #238

Maxou44 opened this issue Jul 3, 2020 · 10 comments
Assignees
Labels
enhancement New feature or request started This issue is being worked on

Comments

@Maxou44
Copy link

Maxou44 commented Jul 3, 2020

Hello :)

First of all, I'd like to thank you for this awesome open source project, it's amazing!

In August 2020, Chrome will be able to show AVIF images.

Source: https://chromium-review.googlesource.com/c/chromium/src/+/2276542

Because libvips already support AVIF format, it could be nice to add this format in weserv project, what do you think?

Have a great day,
Maxime

@andrieslouw andrieslouw added enhancement New feature or request triage This issue is being investigated labels Jul 3, 2020
@andrieslouw
Copy link
Member

Will need to check this, thanks for the heads-up!

@kleisauke
Copy link
Member

Reading 8-bit AVIF images should already work, see for example:
https://images.weserv.nl/?url=http://download.opencontent.netflix.com.s3.amazonaws.com/AV1/Chimera/AVIF/Chimera-AV1-8bit-1920x1080-6736kbps-100.avif&output=jpg

However, some AVIF images (with the ftypavif magic bytes) cannot be decoded properly. This requires PR libvips/libvips#1657, which is available in libvips 8.10 (to be released soon).

Writing AVIF images requires some research on our side to see if our servers can handle that. It also requires some minor adjustments to the codebase.

@Maxou44
Copy link
Author

Maxou44 commented Jul 10, 2020

Firefox Nightly supports AVIF ☺️

kleisauke added a commit that referenced this issue Dec 22, 2020
@andrieslouw andrieslouw added started This issue is being worked on and removed triage This issue is being investigated labels Feb 20, 2021
@andrieslouw
Copy link
Member

We started some work on this, but it is really beta, and AVIF-encoding will be an uphill battle (consuming lots of resources). We will notify you here if we start testing on images.weserv.nl, for now you can experiment using our code, the support is there as per ac3e355 .

@Maxou44
Copy link
Author

Maxou44 commented May 5, 2021

It works well, I didn't found a bug on hundreds of images 😍
Really awesome 😎

@mehulmpt
Copy link

mehulmpt commented Nov 6, 2021

Thanks for adding support for avif! Any expected timeline by when it could be used on the main images.weserv domain?

@kleisauke
Copy link
Member

AVIF decoding should already be supported (live demo). Unfortunately, AVIF encoding is slow and consumes a lot of resources even when rav1e is used, which is why we disabled it in the &output parameter. You might consider using our code to set up your own solution for full AVIF support.

Note that we are considering supporting JPEG-XL, as it is a good competitor to AVIF. However, it is not currently supported within the modern web browsers by default: https://caniuse.com/jpegxl.

@FinnRG
Copy link

FinnRG commented Jul 20, 2023

@kleisauke Apple just announced that they will add JPEG-XL support in the upcoming Safari 17 release (source). It's likely that this will motivate the other browser vendors to improve their implementations as well. Are there any updates regarding JPEG-XL support for wsrv.nl?

@charsleysa
Copy link

@kleisauke now that all major browsers support AVIF and it's considered a Baseline 2024 feature, is there any chance of having it supported as an output?

The bandwidth savings compared to JPEG can be quite significant. Using https://squoosh.app, anecdotally I've found a ~20% file size reduction comparing JPEG @ 75 quality vs AVIF @ 75 quality 0 effort and a ~32% file reduction with AVIF @ 75 quality 2 effort.

@kleisauke
Copy link
Member

@FinnRG JPEG XL support is blocked on libjxl/libjxl#1450 and libvips/libvips#3132. Furthermore, I would also like to see this being fuzzed in libvips' OSS-Fuzz integration before we enable it on our servers (see commit google/oss-fuzz@890953f for details).

@charsleysa Comment #238 (comment) is still relevant today, see e.g. issue libvips/libvips#2983.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request started This issue is being worked on
Development

No branches or pull requests

6 participants