Brief: This guide shows you how to view WebP images in Linux and how to convert WebP images to JPEG or PNG format.
What is WebP?
It’s been over five years since Google introduced WebP file format for images. WebP provides lossy and lossless compression and WebP compressed files are around 25% smaller in size when compared to JPEG compression, Google claims.
Google aimed WebP to become the new standard for images on the web but I don’t see it happening. It’s over five years and it’s still not adopted as a standard except in Google’s ecosystem. But as we know, Google is pushy about its technologies. Few months back Google changed all the images on Google Plus to WebP.
If you download those images from Google Plus using Google Chrome, you’ll have WebP images, no matter if you had uploaded PNG or JPEG. And that’s not the problem. The actual problem is when you try to open that files in Ubuntu using the default GNOME Image Viewer and you see this error:
Could not find XYZ.webp
Unrecognized image file format
In this tutorial, we shall see
- how to add WebP support in Linux
- list of programs that support WebP images
- how to convert WebP images to PNG or JPEG
- how to download WebP images directly as PNG images
How to view WebP images in Ubuntu and other Linux
GNOME Image Viewer, the default image viewer in many Linux distributions including Ubuntu, doesn’t support WebP images. There are no plugins available at present that could enable GNOME Image Viewer to add WebP support.
This means that we simply cannot use GNOME Image Viewer to open WebP files in Linux. A better alternative is gThumb that supports WebP images by default.
To install gThumb in Ubuntu and other Ubuntu based Linux distributions, use the command below:
sudo apt-get install gthumb
Once installed, you can simply rightly click on the WebP image and select gThumb to open it. You should be able to see it now:
Make gThumb the default application for WebP images in Ubuntu
For Ubuntu beginners, if you like to make gThumb the default application for opening WebP files, just follow the steps below:
Step 1: Right click on the WebP image and select Properties.
Step 2: Go to Open With tab, select gThumb and click on Set as default.
Make gThumb the default applications for all images
gThumb has a lot more to offer than Image Viewer. For example, you can do simple editing, add color filters to the images etc. Adding the filter is not as effective as XnRetro, the dedicated tool for adding Instagram like effects on Linux, but the basic filters are available.
I liked gThumb a lot and decided to make it the default image viewer. If you also want to make gThumb the default application for all kind of images in Ubuntu, follow the steps below:
Step 1: Open System Settings
Step 2: Go to Details.
Step 3: Select gThumb as the default applications for images here.
Alternative programs to open WebP files in Linux
It is possible that you might not like gThumb. If that’s the case, you can choose one of the following applications to view WebP images in Linux:
- XnView (Not open source)
- GIMP with unofficial WebP plugin that can be installed via this PPA that is available until Ubuntu 15.10. I’ll cover this part in another article.
Convert WebP images to PNG and JPEG in Linux
There are two ways to convert WebP images in Linux:
- Command line
1. Using command line to convert WebP images in Linux
You need to install WebP tools first. Open a terminal and use the following command:
sudo apt-get install webp
Convert JPEG/PNG to WebP
We’ll use cwebp command (does it mean compress to WebP?) to convert JPEG or PNG files to WebP. The command format is like:
cwebp -q [image_quality] [JPEG/PNG_filename] -o [WebP_filename]
For example, you can use the following command:
cwebp -q 90 example.jpeg -o example.webp
Convert WebP to JPEG/PNG
To convert WebP images to JPEG or PNG, we’ll use dwebp command. The command format is:
dwebp [WebP_filename] -o [PNG_filename]
An example of this command could be:
dwebp example.webp -o example.png
2. Using GUI tool to convert WebP to JPEG/PNG
For this purpose, we will use XnConvert which is a free but not open source application. You can download the installer files from their website:
Note that XnConvert is a powerful tool that you can use for batch resizing images. However, in this tutorial, we shall only see how to convert a single WebP image to PNG/JPEG.
Open XnConvert and select the input file:
In the Output tab, select the output format you want it to be converted. Once you have selected the output format, click on Convert.
That’s all you need to do to convert WebP images to PNG, JPEg or any other image format of your choice.
Download WebP images as PNG directly in Chrome web browser
Probably you don’t like WebP image format at all and you don’t want to install a new software just to view WebP images in Linux. It will be a bigger pain if you have to convert the WebP file for future use.
An easier and less painful way to deal with is to install a Chrome extension Save Image as PNG. With this extension, you can simply right click on a WebP image and save it as PNG directly.