Open AdamPetroff opened 2 years ago
Hi @AdamPetroff, Thanks for the suggestion. Next.js default behavior is to use the WebP format, so I have made the same choice. The browser support is quite limited: https://caniuse.com/avif Therefore, we would need to generate more files (AVIF and WebP versions) for a relatively small gain in compression efficiency. I would suggest keeping the default as WebP, but you can code the use of AVIF as an option if you like.
Hi, @Niels-IO I suggest this get re-opened. Since May 2022, browser support is actually way better, and size advantages + visual fidelity over WebP has continued to improve. It's actually quite noticeable now, and worth supporting.
Additionally, sharp supports avif natively now, and NextJS <Image>
supports it too.
Might be a good idea to use <picture>
tag with fallbacks: avif
-> webp
-> jpg/png
One pitfall I see currently is the lack of support for animated images on iOS Safari. With webp, this would work. So if the user would choose avif as the primary format, I would have to stop using the webp format for animated images and directly fall back to jpg/png. I may consider implementing it :)
Hi, is there a specific reason why there is only conversion to WEBP available? AVIF is supposed to be even better. I'm thinking about coding it up, but I wanted to ask first. There could be the option to convert to avif by default, with the fallback to webP / orginal, if the browser doesn't support AVIF.