WebP Thumbnail Images in Thunar

WebP Thumbnail Images in Thunar
Share on:

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 th 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 manger. This may be because Thunar doesn’t support the creation of thumbnails for WebP images OOTB 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 manger makes things just a little easier.

Thankfully, 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.

sudo pacman -S libwebp tumbler

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

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

and enter the following into the file,

[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=webp Thumbnailer
MimeType=image/webp;
Exec=/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.

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

In this new file, enter the following,

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

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

Back in the terminal, run,

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

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