WebP support

Templ fully supports WebP. Conversion can be done either by Templ or using a plugin for WordPress. Here's how...

Emanuel avatar
Written by Emanuel
Updated over a week ago

WebP is a modern image format that offers much more efficient compression compared to jpeg and png, which of course can help speed up your website.

All jpeg and png files uploaded to WordPress can be converted to WebP format either directly on the server or using a WordPress plugin.

Converting images to WebP directly on the server

Image conversion directly on the server is much more efficient compared to conversion using a plugin for WordPress.

To get started using WebP, open the site in question in the Templ Panel and navigate to the Advanced tab, followed by Image Conversion.
​
To activate automatic WebP conversion, simple change the toggle to On and click Save.


​

Converting images to WebP using a WordPress plugin

If you prefer converting your images using a plugin for WordPress, that is of course OK too.

We support and have tested WebP conversion using these plugins:

  • WebP Express

  • Smush

  • Imagify

  • ShortPixel

All these plugins requires custom configuration to work, simply reach out us to get it done.

If you wish to use any other plugin that's not listed above, that should be fine too. Just contact us and we'll help you out!

Testing WebP images

After conversion to WebP, it's good to know how to test and make sure it's working.

Most of today's WebP conversion methods (including all methods mentioned above) will at a first glance appear to be serving jpeg or png, just like before, as the file extension of the files being served to the visitors will not be changed.

To see that WebP images are in fact being served, one can open the network tab in one's browser and look at the "type" column:

Changing WebP image quality

By default, conversion to WebP is done with a slightly "lossy" compression, meaning that some might notice a visual difference between the outputted WebP image and the original image.

If you want to change this behavior and instead use "lossless" conversion, meaning that there will be no visual difference the converted image and the original image, you can reach out to our support for help or change this behavior yourself by adding a small configuration file to your site.

To change to lossless conversion, create/edit the file ~/.templ/optimizer and add the following content to it:

OPTIMIZER_WEBP="-lossless"

After changing this setting, you may also need to clear the cache of any previously converted WebP images. This can be done by emptying the directory .templ/cache/webp/ which is located under a site's webroot.

Need help? Have questions?

Feel free to start chatting with us at any time and we'll be happy to help! πŸ™‚

Did this answer your question?