I was looking for a way to get WebP image thumbnails in GTK applications (especially Nautilus / GNOME Files), and most solutions I found were ‘hacky’, until I found the rather unknown WebP GDK Pixbuf Loader library. So I thought I’d write about it here on Linux Uprising, in case some of you are also interested in this.
This library / WebP thumbnailer currently only supports static WebP images, but there is work to add support for animated WebP image thumbnails.
Install the WebP GDK Pixbuf Loader library to get thumbnails for WebP images in GTK applications
The library is already packaged and available in Fedora, Arch Linux / Manjaro, openSUSE Tumbleweed and more, so you can install it from the repositories in those cases. It’s not available in the Debian / Ubuntu repositories, so in case that’s what you’re using, you need to build it from source (instructions a bit further down this page).
Install it in Fedora, Arch Linux / Manjaro or openSUSE Tumbleweed:
sudo dnf install webp-pixbuf-loader
- Arch Linux / Manjaro:
sudo pacman -S webp-pixbuf-loader
- openSUSE Tumbleweed:
sudo zypper install webp-pixbuf-loader
To install it on Debian / Ubuntu (and Pop!_OS, Linux Mint, Elementary OS, etc.), you’ll need to build it from source. Start by installing its build dependencies:
sudo apt install libwebp-dev libgdk-pixbuf2.0-dev meson build-essential
Next, download the latest webp-pixbuf-loader
.tar.gz archive from its releases page, and extract the archive. Then open a terminal, navigate to the folder where you’ve extracted the archive, and build and install it using these 3 commands:
meson builddir -Dgdk_pixbuf_query_loaders_path=/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
ninja -C builddirsudo ninja -C builddir install
Installing webp-pixbuf-loader on Ubuntu (and probably Debian too), the thumbnailer file has the wrong location of
gdk-pixbuf-thumbnailer. To fix it, we need to replace
/usr/local/share/thumbnailers/webp-pixbuf.thumbnailer (both instances). You can either do this manually, or use the command below to do this (this is a single command – triple click the line to select it):
sudo sed -i 's//usr/local/bin/gdk-pixbuf-thumbnailer//usr/bin/gdk-pixbuf-thumbnailer/g' /usr/local/share/thumbnailers/webp-pixbuf.thumbnailer
Now it’s time to give this a try! Open a GTK application such as Nautilus or Thunar. Make sure it wasn’t already running, so close all instances and reopen it if it was already running, e.g. if you’re using Nautilus or Thunar, you can quit all instances by running
nautilus -q or
Next, navigate to a folder containing static WebP images. You can use this Wikipedia image (source) for testing if you want. You should now see thumbnails for non-animated WebP images.
In case you’re not seeing any thumbnails for WebP images, you can try to clear the thumbnail cache (this will remove all thumbnails, so they will need to be regenerated):
rm ~/.cache/thumbnails/normal/*.pngrm ~/.cache/thumbnails/large/*.png