WebP Thumbnail Images in Thunar

The WebP format, which is developed by Google is becoming ever more popular on the net these days. With many popular websites and web browsers adopting it. WebP offers a modern image format that “provides superior and lossy compression for images on the web”.

Having played with the file format myself, I can confirm that using WebP can dramatically reduce the file size of images, while keeping almost the same level of detail as a source image as in the “PNG” format. On top of that, WebP offers transparency support, similar to PNG and GIF.

The WebP Problem On The Desktop

I was browsing reddit for some wallpapers for my desktop the other day, and happened to notice that I couldn't view these images in my file manager. This may be because Thunar doesn't support the creation of thumbnails for WebP images out of the box just yet.

I could have just opened Gthumb or XnView MP on Manjaro to view these files, however, I have folders which contain hundreds of these images which I have collected from the net, and having the ability to preview them right from within my file manager makes things just a little easier.

Just like everything else on Linux, "Where there's a will, there's a way". So, after a bit of head scratching, I found a simple solution that worked for me.

How To Preview WebP Images In Thunar

First, open a terminal in Manjaro and install "libwebp" & "tumbler" if you don't have them on your system already.

1sudo pacman -S libwebp tumbler

Next, create a ".thumbnailer" file in /usr/share/thumbnailers/

1cd /
2sudo nano /usr/share/thumbnailers/webp.thumbnailer

and enter the following into the file,

1[Thumbnailer Entry]
2Version=1.0
3Encoding=UTF-8
4Type=X-Thumbnailer
5Name=webp Thumbnailer
6MimeType=image/webp;
7Exec=/usr/bin/convert -thumbnail %s %i %o

press Ctrl o , then Return to save and Ctrl x to quit nano.

Next, create a mime type for WebP.

1cd ~
2nano .local/share/mime/packages/webp.xml

In this new file, enter the following,

1<?xml version="1.0" encoding="UTF-8"?>
2<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3    <mime-type type="image/webp">
4        <comment>WebP file</comment>
5        <icon name="image"/>
6        <glob-deleteall/>
7        <glob pattern="*.webp"/>
8    </mime-type>
9</mime-info>

Press Ctrl o , then Return to save, then Ctrl x to quit nano.

Back in the terminal, run,

1update-mime-database ~/.local/share/mime

After doing this and performing a quick relog, You should then able to preview WebP image thumbnails in Thunar.