WebP is a concept you will come across when doing speed optimization for your website. Google PageSpeed Insights flags it in their speed analysis report same as other speed test tools. Although, we've already covered everything about WebP images in Magento, for those who don't know:
WebP is a modern file format created by Google and supported by a variety of browsers. This file is known for being smaller in size than regular PNG, JPEG, or GIF files. That's why it becomes more popular across eCommerce websites.
If you decide to try this format for your website, you will most likely fail to upload it to the system.
So today, we'll tell you everything about why you can't upload WebP images to Magento 2. But here's a guide on how to upload WebP to Magento, if you're too determined to do that.
Does Magento Allow to Upload WebP Images?
If you try uploading images in WebP format to Magento, you will get the Disallowed file type error and the file won't upload.
At this stage, you might be confused as to why Magento doesn't allow uploading WebP files. But it even benefits you.
ECommerce flourishes around images since they are exactly what sells your products. That's why it is extremely important to keep customers satisfied with the speed and maintain great image quality at the same time. And that's what WebP formats for.
However, while WebP is supported by a lot of browsers, some older versions of them provide partial or no WebP support.
So imagine people coming from those browsers that don't support WebP. Instead of beautiful and high-quality images, they will see nothing and will be forced to leave your store.
Magento doesn't allow you to upload WebP images directly to avoid this situation. We believe they would add this feature once 100% of browsers are fully compatible with the WebP format.
But for now, you should convert images to WebP and store your original images on the server.
How to Convert Images to WebP?
If you can't upload WebP images to Magento directly you should use tools that convert them automatically. Our WebP Images Extension is a feature-rich solution that helps you to convert images to WebP format in different ways: automatically on page load and by cron, or manually.
Instead of replacing your PNG, JPEG, or GIF images, it creates a copy in WebP format. This allows you to load WebP images for people who come from WebP-friendly browsers and original images for those from non-WebP browsers.
That is also the reason why you might see both PNG/JPEG and WEBP when checking Elements. But note that the extension only loads one of them based on the visitor's browser.
To see what images are loaded, check the Network tab, set the Img filter, and reload the page.
You can also check this video where we describe WebP testing in more detail:
If you can't upload WebP images to Magento, don't force it. Although there are extensions that will help you to do that, all you'll achieve is a bad customer experience. Instead, use extensions that enable you to satisfy all customers, regardless of the browser.