-
Notifications
You must be signed in to change notification settings - Fork 855
Description
Hello, I just wanted to know what is the rationale (if there is one) behind serving webp instead of avif if the browser supports both and both are enabled in AUTO_* options?
Relevant code:
thumbor/thumbor/handlers/__init__.py
Lines 498 to 510 in 252c5b1
| if image_extension is not None: | |
| image_extension = f".{image_extension}" | |
| logger.debug("Image format specified as %s.", image_extension) | |
| elif self.is_webp(context): | |
| image_extension = ".webp" | |
| logger.debug( | |
| "Image format set by AUTO_WEBP as %s.", image_extension | |
| ) | |
| elif self.can_auto_convert_to_avif(): | |
| image_extension = ".avif" | |
| logger.debug( | |
| "Image format set by AUTO_AVIF as %s.", image_extension | |
| ) |
From what I can tell this looks like it's mostly because of historical reasons. The order of the if statements with avif-after-webp was added in #1476 : https://github.com/thumbor/thumbor/pull/1476/files#diff-1a881ee8d8f859902e12d41fa442ce25d70161ef9b66ac04df32444900323a6f
But I'd like to know if there's more to it (avif maturity? Implementation maturity? no clear benefit for avif over webp?), since I'm no image format expert.
I don't think any browser currently supports avif but not webp, so I think avif is only served here if AUTO_WEBP is set to false (so that the order is then AVIF, JPG, HEIF, PNG). Is that intended?
Thanks for your time!