This article was updated and rechecked on 15th of February 2022

Category: Ubuntu Mate

Added: 9th of December 2021

Updated On: 15th of February 2022

Viewed: 2,126 times

Convert image in .png format to .webp on Ubuntu and Ubuntu based distributions

The webp image format has been around for quite a few years, but I only recently found out about it. The Webp image format greatly reduces the file size without losing any quality over formats such as .gif, .png and jpeg.

Gimp on Linux already has this function to export as webp, but you can also install the webp package in Ubuntu or Ubuntu based distributions to convert images to the webp format using the terminal.

With the basic command for converting one image below, you could create a bash script to take a folder of .png images or mixed images and convert these .webp format.

To install webp enter the following command

sudo apt-get install webp

I decided to download the Tux image from which is saved in .png image and convert this to .webp format

Enter the following command
cwebp Tux.png -o Tux.webp

You can also convert images in .gif and .jpeg format to .webp

Below is the original Tux.png image, and below that is the Tux.webp image.
Quality wise they both images look identical, but more interestingly is the overall file size.

Tux.png image 11.9kb
Tux image, .png format (11.9kb)

Tux.webp image 4.6kb
Tux image, .webp format (4.6kb)

If your displaying a lot of images across your website in .webp format, you will make a considerable saving on the file sizes compared to .gif, .png, and .jpeg formats, which also means a faster download of all images for visitors to your website.

Please visit for further information about webp