An example of the WordPress media library editing an AVIF image.

AVIF Support in WordPress 6.5

Earlier this year, WordPress 6.5 shipped with native support for the AVIF image format. This is a big deal when optimizing a site’s performance and image quality. Let’s dive into AVIF, its importance, and how WordPress leverages this technology.

What is AVIF?

AVIF (AV1 Image File Format) is a modern image format that offers superior compression and quality compared to traditional formats like JPEG and PNG. It’s based on the AV1 video codec and can significantly reduce image file sizes without compromising quality. This means faster load times and a better user experience on your site.

AVIF is often associated with and compared to HEIF, another high-compression image format. Where AVIF shines is in its open licensing, as opposed to HEIF, which is closed and requires royalty payments to use. This distinction is especially important as it relates to WordPress, which can’t adopt closed solutions into WordPress core.

Benefits of AVIF Support

Here are some compelling reasons to consider AVIF for your WordPress site:

  • Better Compression: AVIF images are smaller than JPEG and PNG, which means faster load times.
  • Higher Quality: AVIF maintains high image quality despite the smaller file sizes.
  • Future-Proofing: As more browsers and devices support AVIF, enabling it ensures your site is ready for the future.

This blog post from the Alliance for Open Media goes into way more detail about the benefits: AVIF: Meet the Next Level Image File Format

AVIF in WordPress 6.5

With WordPress 6.5, AVIF support is baked right into the core. This means you can upload AVIF images directly to your Media Library, and WordPress will handle them just like any other image format.

For server environments with PHP compiled with AVIF support, WordPress can also edit those images to scale, crop, and rotate.

By supporting AVIF, WordPress sites can use smaller, better-quality images, which improve performance and reduce the amount of data that site visitors need to download.

You can read more about AVIF’s inclusion within the 6.5 WordPress release on the WordPress Core blog.

WP’s Use of AVIF

WordPress’s emphasis on backward compatibility means that the features it supports are written using robust and defensive coding practices.

One consequence is that even if your server doesn’t support AVIF, WordPress includes a polyfill to help read AVIF images, allowing you to upload and add AVIF images to your Media Library.

However, this polyfill does come with limitations. While you can upload and insert AVIF images into posts, editing those images is impossible without server support.

For these reasons, ensuring your PHP setup is AVIF-ready is crucial. Most dedicated hosts have already compiled PHP to include support for AVIF. If you’re like me and tasked with getting this working, I’ll go into more detail in upcoming posts about compiling PHP with AVIF support.


Posted

in

by