humaans / next-img

A Next.js plugin for embedding optimized images.
https://humaans.github.io/next-img/
273 stars 11 forks source link

AVIF support #7

Open stopyransky opened 4 years ago

stopyransky commented 4 years ago

Hi,

is there a chance to include AVIF file support in the plugin ? It is new format for media files, not yet supported by all browsers but it's on the way.

Examples of implementation as Progressive Enhancement with AVIF:

<picture>
    <source srcset="img/photo.avif" type="image/avif">
    <source srcset="img/photo.webp" type="image/webp">
    <img src="img/photo.jpg" alt="Description of Photo">
</picture>

Sources: https://reachlightspeed.com/blog/using-the-new-high-performance-avif-image-format-on-the-web-today/ https://www.ctrl.blog/entry/webp-avif-comparison.html

KidkArolis commented 4 years ago

100%, will be adding that in the near future. Need to understand if Sharp's implementation will work or if another lib will be necessary.

KidkArolis commented 4 years ago

There's some discussion here on sharp's support for avif: https://github.com/lovell/sharp/issues/2289

KidkArolis commented 1 year ago

Sharp added avif, so this should be possible to implement now!