imgix / gatsby

A simple yet powerful integration between Gatsby and imgix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVIF format not showing

AdamQuadmon opened this issue · comments

I'm using ImgixGatsbyImage on Gatsby v4 but setting auto:['format']as imgixParams still serve a JPG and not an AVIF image.
Using the local version of the .JPG image with gatsby-plugin-image serve an AVIF

What's wrong here?

<ImgixGatsbyImage
  src="https://mysource.imgix.net/image.jpg"
  imgixParams={{ crop: 'faces', auto: ['compress', 'format'] }}
  layout="fullWidth"
  aspectRatio={3 / 2}
  alt="test"
/>
<StaticImage
    src="../images/image.jpg"
    layout="fullWidth"
    alt="test"
/>

Checking it better I found that the served .jpg image is actually in image/avif format even if the file extension is still .jpg

I didn't saw any difference in file size

Hi @AdamQuadmon, Fred from imgix here 👋 Thanks for opening the issue. Could you please share an example URL that this plugin is generating that is not being rendered as an AVIF despite having auto=format? Then I can investigate this further.

As response your later comments:

Checking it better I found that the served .jpg image is actually in image/avif format even if the file extension is still .jpg

This is the expected behaviour with imgix - we don't rewrite the url file extension

I didn't saw any difference in file size

What do you mean exactly by this? Between the JPG and the AVIF image? Or between the gatsby-sharp AVIF version and imgix AVIF version?

I was just assuming to find the same behaviour in this plug in as for the gatsby-plugin-image one but I'm realizing they are different.

I checked better and there is some difference between JPG and AVIF

The original file is 1.6M
The JPG one 560kb (auto=compress)
The AVIF 512kb (auto=compress,format)

thanks for the quick reply!

It seems to me that everything is working as expected at this stage so I'll close out this issue. If you're still facing issues please feel free to reply further and we can discuss.