We are all certainly familiar with the popularity of image file formats like JPEG, PNG, and GIF. Well, Google came up with a standard image file format replacement for the likes of JPEG, PNG, and GIF and gave it the name WebP.
So what makes WebP a preference over the other mentioned image file formats? Firstly, WebP’s design offers better lossless and lossy compression in comparison to web image attributes offered by other image file formats. Also, web developers and webmasters benefit from faster web sessions due to the use of WebP to create smaller and richer images.
WebP Performance Comparison Against Other Image File Formats
In comparison to PNG images, the lossless nature of WebP images makes them 26% smaller. In comparison to JPEG, the lossy nature of WebP images makes them 25%-34% smaller.
Therefore, at 22% additional bytes, a lossless WebP image will support transparency (alpha channel). Also, a lossy WebP image will support transparency when lossy RGB compression is not prohibited. The latter event leads to a 3X smaller image file when a comparison is drawn against PNG images.
Problem Statement
Now that we have understood the concept and applicability behind WebP images, it is time to address the main objective of this article. This article assumes you have come across a WebP image file while on a google search or during your random Linux file management operations.
However, you have no idea of how to open WebP image files with your default Image Viewer application due to compatibility issues with your Linux operating system environment.
As per the above screen capture, the recommended applications for viewing the WebP file (image.webp)
are major web browsers like Brave, Google Chrome, and Firefox and reputable Image Manipulation Programs like GNU Gimp.
We however need the default Linux image viewer to natively support the preview of WebP image file format for convenience purposes especially when we need to quickly scan through our WebP image files.
Viewing WebP Images in Linux
We want our default Linux image viewer to comfortably support the preview of WebP images without having to resort to solutions like installing an image viewer that supports WebP image file format or converting our WebP images to compatible formats like PNG, GIF, and JPEG before viewing them.
Enable WebP Support on Linux
The aim of this step is to successfully guide us to the installation of the WebP GDK Pixbuf Loader library. Here, you first need to run a system update command on your Linux operating system distribution and make sure you have root/sudoer user privileges on the Linux machine you are using.
To install the WebP GDK Pixbuf Loader library on different Linux distributions, reference the following Installation commands:
$ sudo yum install webp-pixbuf-loader [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a gui-libs/gdk-pixbuf-loader-webp [On Gentoo Linux] $ sudo pacman -S webp-pixbuf-loader [On Arch Linux] $ sudo zypper install webp-pixbuf-loader [On OpenSUSE]
On Debian, Ubuntu and Mint, you need to add the following PPA to install it as shown.
$ sudo add-apt-repository ppa:helkaluin/webp-pixbuf-loader $ sudo apt update $ sudo apt install webp-pixbuf-loader
Another utility that can be used to view webp images in Linux is called gthumb.
$ sudo apt install gthumb [On Debian, Ubuntu and Mint] $ sudo yum install gthumb [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a media-gfx/gthumb [On Gentoo Linux] $ sudo pacman -S gthumb [On Arch Linux] $ sudo zypper install gthumb [On OpenSUSE]
Open WebP Images in Linux
We can now attempt to open our WebP image with the default Linux Image Viewer.
And just as expected, the WebP image is now viewable from our Linux OS’s image viewer.
Hope you found this article useful. Feel free to leave a comment or feedback.
Fedora has used “dnf” for the last several releases. Maybe you need to update this item. Anyone that is new to Fedora would probably not be familiar with yum.
Please consider removing the leading
"$"
in front of each line. When we noobs (or any quick-selecting reader) copy the text to paste it into the terminal, big chance we will grab the whole line which results in “$ Command not found“.Only later figuring out the double
$$
. Thanks for an otherwise very helpful post.@LinuxTester,
I completely understand your concern, but these symbols are more important and it indicates that the command is run by the normal user
($)
or the root user#
.Since the command is prefixed by “sudo” it’s pretty obvious that is the regular user and not the root, which would not be using the command “sudo“. Just saying