Developed by Google with the main objective of making loading times faster across the internet, WebP (pronounced “weppy”) is a modern image format and a replacement for JPEG, PNG, and GIF file formats.
Compared to other image formats, webp offers superior lossless and lossy compression for images on the web. WebP is one of the many projects by Google that supports its mission to make the web faster.
On Ubuntu-based and RHEL-based Linux distributions, the default image viewer does not support .web
format images.
If you try to view WebP image with your default photo viewer or web browser, you will get the following error:
Could not load image XYZ.webp Unrecognized image file format
To allow GDK applications such as Eye of Gnome (GNOME Image Viewer) to be able to view WebP images and animations, you need to install the webp-pixbuf-loader package.
WebP GDK Pixbuf Loader library is a third-party package and is not available for installation from the official repositories. You can install it from a PPA (Personal Package Archive) owned by Jonathan Yip.
Table of Contents
Enable WebP Support to GNOME Image Viewer in Linux
On Ubuntu-based distributions, run the following command to add the PPA (Personal Package Archive) to your system, then update the APT package manager’s package cache to pick the list of the latest software within configured repositories in the system and install the package.
$ sudo add-apt-repository ppa:helkaluin/webp-pixbuf-loader $ sudo apt update $ sudo apt install webp-pixbuf-loader
On Fedora, users should run the following command to install it:
$ sudo dnf install webp-pixbuf-loader
On RHEL and other enterprise Linux distributions, enable the EPEL repository, then install it as follows:
$ sudo yum install epel-release $ sudo dnf install webp-pixbuf-loader
On Arch Linux, issue the following command:
$ sudo pacman -S webp-pixbuf-loader
To test if the package is working, open the default image viewer on your Ubuntu or Linux mint desktop and view a webp image with it.
After opening the image, you should be able to view it without any error as shown in the following screenshot.
View WebP Images Using gThumb Image Viewer in Linux
gThumb is an image viewer and browser for the GNOME environment that comes with Webp support. You can install it on your Linux distribution using your package manager as shown:
$ sudo apt install gthumb [On Debian, Ubuntu and Mint] $ sudo yum install gthumb [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a media-gfx/gthumb [On Gentoo Linux] $ sudo apk add gthumb [On Alpine Linux] $ sudo pacman -S gthumb [On Arch Linux] $ sudo zypper install gthumb [On OpenSUSE]
Once the package is installed, locate where the .webp
image is, right-click on it, then go to Open with, and click Other application.
From the list of applications, search for gThumb and set it as the default application for opening and viewing Webp files/images. Then click OK, as highlighted in the following screenshot.
Now you should be able to open and view your WebP images.
Note that if you intend to convert your images from PNG and JPEG to webp format, you can use the dwebp or cwebp conversion tools as described below.
Convert WebP Images to PNG or JPEG Using dwebp Utility
To convert/decompress a Webp file into a PRN/JPEG image format on the command-line interface, you need to install the webp package as shown.
$ sudo apt install webp
If the installation is successful, you should now have a utility called dwebp (which is part of libwebp) that you can use to convert .webp
images to .png
or .jpeg
.
The following is an example where the -o
flag specifies the output filename:
$ dwebp image.webp -o image.png $ dwebp image.webp -o image.jpeg
For more information, check the man page for dwebp:
$ man dwebp
Convert PNG or JPEG to WebP Using cwebp Utility
To convert a PNG/JPEG image file to a Webp file, use the cwebp utility. In this example, the -q
flag is used to define the image quality:
$ cwebp -q 90 Selection_603.png -o Selection_603.webp
Here are more examples:
$ cwebp -q 60 -lossless image.png -o image_lossless.webp $ cwebp -q 80 image_with_alpha.png -o image_with_alpha.webp $ cwebp -sns 80 -f 50 -size 60000 image.png -o image.webp $ cwebp -o image.webp --image.png
For more information, check the man page for cwebp:
$ man cwebp
Convert WebP Images to PNG or JPEG Using XnConvert
XnConvert is a fast, powerful, and free multi-platform batch image converter that runs on Linux, Windows, and MacOS. It supports over 80 actions for managing images on your computer such as resizing, cropping, color adjustments, filtering, and much more.
It supports the most common picture and graphics formats such as JPEG, PNG, WebP, GIF, OpenEXR, camera RAW, HEIC, PDF, DNG, CR2, and much more.
To install it, download the .deb
package from the project’s official website and install the XnConvert DEB package as shown:
$ sudo dpkg -i ~/Downloads/XnConvert-linux-x64.deb
After successfully installing it as shown in the previous screenshot, search for it in the system menu, and open it. Click on Add Files button to load an image file into the application for processing.
Next, click on the Output tab, under Format, and select the new format you wish to convert the current image format to, from the drop-down menu. And then click Convert.
In this example, we are converting a .png
image file to a .webp
format.
That’s all! Let us know your thoughts about this guide or webp image format via the comment section below.