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

Enhancement: avif support for Photon #35432

Open
Tracked by #33615
asafm7 opened this issue Feb 3, 2024 · 11 comments
Open
Tracked by #33615

Enhancement: avif support for Photon #35432

asafm7 opened this issue Feb 3, 2024 · 11 comments
Labels
Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal Triaged [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@asafm7
Copy link

asafm7 commented Feb 3, 2024

Impacted plugin

Jetpack

What

Avif support for Photon

How

With the latest Edge version adding support for avif, all maintained browsers now support avif.

Work on adding avif support for WordPress core is made, and it might land with WordPress 6.5.

Is there a plan to add avif support for Photon?

Also, how currently Photon treats avif? Is it excluded from the CDN?

@asafm7 asafm7 added the [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it label Feb 3, 2024
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Feb 3, 2024
@jeherve jeherve added [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Plugin] Boost A feature to speed up the site and improve performance. [Pri] Normal labels Feb 5, 2024
@jeherve
Copy link
Member

jeherve commented Feb 5, 2024

Related core enhancement:

Prior art for HEIC / HEIF images: #33494

@jeherve
Copy link
Member

jeherve commented Feb 7, 2024

cc'ing @flaviozavan for visibility; Is that something that's been on your radar for Photon?

@flaviozavan
Copy link

flaviozavan commented Feb 7, 2024

Photon supports AVIF as input, but is unable to output it. The code exists and works, but AVIF encoding is much slower than other formats. Therefore, we just convert it. If we were to enable encoding, we would need some async strategy, and a significant overhaul of how Photon works. This is not something we are currently looking into, but it's within the real of possibility if we can justify it.

@asafm7
Copy link
Author

asafm7 commented Feb 7, 2024

Thanks @flaviozavan.

How does the CDN currently treat AVIF? (assuming the image is already converted to AVIF)

Does it ignore it and the image is loaded locally? does it serve it as-is? does it convert it to other formats?

Assuming the image is already AVIF, can it be resized by Photon? or is this too slow?

I wonder if Photon can continue converting images only to webp, but if the source image is already AVIF will be able to transform it (resizing etc.)

@asafm7
Copy link
Author

asafm7 commented May 6, 2024

@haqadn, does it mean Jetpack now supports AVIF?

@adamsilverstein
Copy link
Contributor

Photon supports AVIF as input, but is unable to output it. The code exists and works, but AVIF encoding is much slower than other formats. Therefore, we just convert it. If we were to enable encoding, we would need some async strategy, and a significant overhaul of how Photon works. This is not something we are currently looking into, but it's within the real of possibility if we can justify it.

@flaviozavan Sharing this ticket in core - https://core.trac.wordpress.org/ticket/61758#comment:12 - where we improved AVIF speed generation by ~20% (the default settings try too hard). Also important to make sure you are using the latest libavif encoder which has made significant strides in encoding speed. You may need to build your own imagick, but the results should be worth it, maybe allowing you to avoid the async strategy?

Here are some stats you can compare by encoder version, the performance of the most recent encoder with (speed 6) seems quite good. Raising the speed to 7 would be even better.

@adamsilverstein
Copy link
Contributor

adamsilverstein commented Dec 2, 2024

cc: @haqadn can we re-open this ticket as a tracking ticket for the addition of AVIF (serving) support for Photon, or would you prefer that I open a new ticket?

@adamsilverstein
Copy link
Contributor

cc: @yguyon

@jeherve jeherve reopened this Dec 2, 2024
@jeherve jeherve moved this from Done 🎉 to Triaged in Automattic Prioritization: The One Board ™ Dec 2, 2024
@y-guyon
Copy link

y-guyon commented Dec 3, 2024

Please find below some comparison data from September 2024. It is in line with AVIF 4:2:0 speed 7 (libavif+aom) being much closer to WebP (libwebp) than speed 5 for encoding time:
https://storage.googleapis.com/demos.webmproject.org/webp/cmp/2024_09_04/index.html?load=all_420.json

Specifically, at web-range bpp, on 2-3 MP photos, assuming the default method 4 of libwebp is used, we roughly have for the same SSIMULACRA2 distortion:
libavif speed 7 generating 25% smaller files for twice the encoding time (plot),
libavif speed 8 generating 20% smaller files for a similar encoding time (plot).

@bobmatyas
Copy link
Contributor

This came up on 9227005-zen

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Support References

This comment is automatically generated. Please do not edit it.

  • 9227005-zen

@github-actions github-actions bot added the Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal Triaged [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
Development

No branches or pull requests

7 participants