WordPress has given us one more reason to look forward to its next release in July 2021 – WebP support. From WordPress version 5.8 onward, you can upload and use WebP images in WordPress like you would a JPEG or PNG image today (as long as your hosting service supports WebP).
What is WebP?
WebP, the “next-gen” image format, enables you to offer higher-quality media at smaller sizes. With this format, you can achieve superior image quality at drastically lower sizes than JPEGs or PNGs.
Google (which created the WebP format) claims that lossless WebP images are up to 26% smaller than their PNG counterparts. With lossy compression, that number goes up to 25–34%. Google even recommends you use WebP images if you test your website using PageSpeed Insights.
Currently, WordPress does not support WebP out of the box. But this is about to change now.
Creating WebP images
You can create WebP images with command line conversion tools or web-based tools like Squoosh or export to WebP format with image editing tools. Once you save your images as WebP, upload them to WordPress and use them like you would any other image.
Using WebP images
WebP images support lossy and lossless compression and an animated format and support for transparent images. In WordPress, the lossless WebP format is only supported when the hosting server uses Imagick. In addition, animated and alpha formats are not yet supported for resized images (lossy images are created instead when you upload in these formats).
WebP support in the media library requires that your web server’s image processing library (WordPress supports both Imagick and LibGD) supports the WebP format. If your web server does not support WebP, you will see an error message when you try to upload a WebP image.
Developers or plugins can use the wp_editor_set_quality filter to set the quality setting used for WebP images.
Advantages of using WebP images
WebP provides high-quality media at smaller file sizes. They are significantly smaller than their JPEG equivalents, so visitors to your site will see the complete page loaded more quickly. Smaller images take less bandwidth to transmit, and your images still get all of the responsive benefits of srcset and lazy loading by default. The end result is a better website performance, visitor experience and a higher SEO ranking.
WebP is supported in all major browsers, so most sites can start using them immediately. You can also forget the plugins that you have been using to add WebP support to WordPress.
One thing is for sure – WordPress is not going back in its mission to give its users the best web experience. Let’s wait and see what is next on the menu.