AV1 Image File Format (AVIF) is a newer image file format. The first version of the AVIF specification was published in February 2019, and started to be widely supported in modern browsers in 2021.
Ideally, if a JPEG is requested with an
Accept header that includes
image/avif, it will return an AVIF image.
An example of checking for AVIF using curl would look like this
$ curl 'https://cdn.example.com/imnage.jpg' \ -H 'accept: text/html,image/avif' \ -L -so output_image
From there, we check to see what the format of the returned image is.
$ file output_image output_image: ISO Media, AVIF Image
However, not all services offer respect accept headers, despite offering the image formats. In this case, they are manually set to