Use the WebP GDK Pixbuf loader library to display WebP thumbnails in GTK applications (Nautilus, Thunar, etc.)

I am looking for a way to get WebP image thumbnails in GTK applications (especially Nautilus / GNOME files), and Most solutions I found out that it was’hacky’ until I found out that it was quite unknown WebP GDK Pixbuf loader library . So I think I will write this article on Linux Uprising in case some of you are also interested in it.

This library/WebP thumbnail currently only supports static WebP images, but have a job Added support for animated WebP image thumbnails.

Library already Packaged and available In Fedora, Arch Linux/Manjaro, openSUSE Tumbleweed, etc., so you can install it from the repository in these cases. It is not available in the Debian / Ubuntu repositories, so if you are using it, you need to build it from source (instructions at the bottom of this page).

Install it in Fedora, Arch Linux / Manjaro or openSUSE Tumbleweed:

  • Fedora hat:
                        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 download from source . First install 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 Publish page , And extract the archive. Then open a terminal, navigate to the folder where you extracted the archive, and use the following 3 commands to build and install it:


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

ninja -C builddir

sudo ninja -C builddir install

Install webp-pixbuf-loader on Ubuntu (or Debian), the thumbnail file has Wrong location of gdk-pixbuf-thumbnailer . To fix it, we need to replace /usr/local/bin/gdk-pixbuf-thumbnailer with /usr/bin/gdk-pixbuf-thumbnailer exist /usr/local/share/thumbnailers/webp-pixbuf.thumbnailer (Two cases). You can do this manually or use the following command (this is a command-click the row 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 it’s time to try it! Open a GTK application, such as Nautilus or Thunar.Make sure it is not running yet, so close all instances, if it is already running, please reopen it, for example, if you use Nautilus or Thunar, you can exit all instances by running nautilus -q or thunar -q .

Next, navigate to the folder containing the static WebP images.You can use this Wikipedia image ( source ) To test (if needed). You should now see the thumbnail of the non-animated WebP image.

If you don’t see any thumbnails of WebP images, you can try to clear the thumbnail cache (this will delete all thumbnails, so you need to regenerate them):


rm ~/.cache/thumbnails/fail/gnome-thumbnail-factory/*.png

rm ~/.cache/thumbnails/normal/*.png

rm ~/.cache/thumbnails/large/*.png


Related Posts