Cloudflare has announced support for the AVIF image format in its Image Resizing service. According to the firm, AVIF has significantly better compression ability when compared to older formats such as WebP and JPEG. As things stand, only Chrome 85+ and Opera 71+ can use the new image format but support has partially been added to Firefox but isn’t turned on by default.
By adding support for AVIF, Cloudflare will help save bandwidth and make webpages load faster. It claims that AVIF can reduce images by half the size of JPEG and WebP. The popular JPEG format has been around since 1992 and there have been attempts to replace it with JPEG 2000, JPEG XR, and WebP but none of these offered improvements close to AVIF.
Explaining the benefits of AVIF over WebP, Cloudflare said:
“WebP is limited to 8-bit color depth, and in its best-compressing mode of operation, it can only store color at half of the image's resolution (known as chroma subsampling). This causes edges of saturated colors to be smudged or pixelated in WebP. AVIF supports 10- and 12-bit color at full resolution, and high dynamic range (HDR).
AV1 also uses a new compression technique: chroma-from-luma. Most image formats store brightness separately from color hue. AVIF uses the brightness channel to guess what the color channel may look like. They are usually correlated, so a good guess gives smaller file sizes and sharper edges.”
For those that use Cloudflare, the firm explains that AVIF is recommended on websites that need to deliver high-quality images with a small amount of bandwidth, for example, a website tailored to people in a country where mobile data is expensive. Cloudflare recommends the use of Workers that detect and enable support for AVIF, you can read more in the Workers documentation.