I’ve been looking for a way to get WebP image thumbnails in GTK applications (especially Nautilus / GNOME files), and most of the solutions I thought 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 any of you guys are interested.
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 is not available in the Debian / Ubuntu repositories. So if you do use it, you’ll need to build it from source code (instructions a little 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 need to build it from source. Start by installing the build dependencies:
sudo apt install libwebp-dev libgdk-pixbuf2.0-dev meson build-essential
Next, download the latest webp-pixbuf-loader
.tar.gz Archive of his Publications page, and extract the archive. Then open up a terminal, navigate to the folder where you extracted the archive, and create 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
Install webp-pixbuf-loader on Ubuntu (and probably Debian as well) that has thumbnailer file the wrong place from
gdk-pixbuf-thumbnailer. To fix it we have to replace it
/usr/local/share/thumbnailers/webp-pixbuf.thumbnailer (both instances). You can either do this manually or use the following command (this is a single command – click the line three times 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 is the time to give this a try! Open a GTK application like Nautilus or Thunar. Make sure it wasn’t already running, so close all instances and reopen it if it was already running e.g. B. If you are using Nautilus or Thunar, you can terminate all instances by executing
nautilus -q or
If you don’t see thumbnails for WebP images, you can try clearing the thumbnail cache (This will remove all thumbnails so they need to be regenerated):
rm ~/.cache/thumbnails/normal/*.pngrm ~/.cache/thumbnails/large/*.png