How to View WebP Image and Convert WebP to PNG or JPEG in Linux

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
could not load image webp error
could not load image webp error

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.

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.

Open WebP Image in Linux
Open WebP Image in Linux

After opening the image, you should be able to view it without any error as shown in the following screenshot.

View WebP Image in Linux
View WebP Image in Linux

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.

Open WebP Image in gThumb
Open WebP Image in gThumb

Now you should be able to open and view your WebP images.

View WebP Image in gThumb
View WebP Image in gThumb

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
Convert WebP to PNG or JPEG in Linux
Convert WebP to PNG or JPEG in Linux

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
Convert PNG or JPEG to WebP in Linux
Convert PNG or JPEG to WebP in Linux

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.

Open XnConvert Tool
Open XnConvert Tool

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.

XnConvert - Convert PNG to WebP Format
XnConvert – Convert PNG to WebP Format

That’s all! Let us know your thoughts about this guide or webp image format via the comment section below.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.