How to Enable WebP Image Support in Debian 11 / Ubuntu

WebP image files do not open in default image viewer and show as unknown images in file manager in Debian 11 and Ubuntu up to 21.10.

There are more and more WebP images in the web today. However, Debian 11 and Ubuntu so far does not support the file format out-of-the-box.

If you get some WebP files and want to open them in Debian / Ubuntu Linux and/or enable image thumbnails, this tutorial will show you how!

Open WebP with Web Browser:

For lazy men, you don’t have to do anything special. Simply drag and drop the image into web browser such as Firefox will open it.

Or, in file manager right-click on WebP file and click “Open With Other Application” from context menu.

In pop-up dialog, click on ‘View All Applications‘, browse and choose the Firefox web browser from list.

Finally click on ‘Select’ button. And, you are now able to double-click WebP files to open with Firefox browser.

Open WebP with gThumb Image Viewer:

gThumb is a popular Gnome image viewer and organizer app with WebP support. It’s available in the main repositories and pre-installed in some Linux Distributions.

To install gThumb in Ubuntu and Debian, open “terminal” either from start menu or by searching from activities overview screen. When it opens, run command:

sudo apt install gthumb

After that, right-click on WebP file, choose ‘Open With Other Applications’ and select gThumb in the pop-up dialog.

Next time, double-clicking the file will launch and open it with the gThumb image viewer.

Enable WebP thumbnail and Open with Default Image Viewer:

For GNOME, XFCE, and other GTK based desktops, an open-source WebP GDK Pixbuf Loader library is available to enable WebP for default image viewer and thumbnail in file manager.

The library is available in Fedora, Arch, and Gentoo Linux repositories, but not in Debian and Ubuntu. And, below is how to build it from the source.

1. Install build dependencies:

Firstly, search for and open terminal either from start menu or from activities overview screen. When it opens, run command to install the required packages for building the library:

sudo apt install debhelper-compat meson libgdk-pixbuf2.0-dev libwebp-dev git

Type user password when it asks while no visual feedback and hit Enter.

2. Download webp-pixbuf-loader:

To grab the source, run git command in a terminal window:

git clone https://github.com/aruiz/webp-pixbuf-loader.git

3. Build & install webp-pixbuf-loader:

Now go to the source folder in terminal window:

cd webp-pixbuf-loader

Build the library by running the commands one by one:

meson builddir -Dgdk_pixbuf_query_loaders_path=/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
ninja -C builddir

Finally install it via command:

sudo ninja -C builddir install

4. Set GNOME Default Eye of GNOME image viewer as default app to handle WebP:

After step 3, Debian shows thumbnails for WebP and supports for opening with the default EOG image viewer. If not for you, try log out and back in.

To make EOG as default app to handle WebP, run following commands one by one to update MIME database:

xdg-mime default org.gnome.eog.desktop image/webp
sudo update-mime-database /usr/share/mime

Summary:

Though the default image viewer in Debian and Ubuntu does not support WebP image out-of-the-box. Users may either use other apps, e.g., Firefox web browser and/or gThumb image viewer, or install webp-pixbuf-loader to default GTK apps work with WebP.

Merilyn Ne
Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.