Adding WebP Thumbnail Support to Nautilus

calendar

August 7, 2022

categories
Guides
tags
linux nautilus webp

Content:

WebP is a modern image format, optimised for web usage. Many of the images you’ll find on this site are uploaded as WebP files, due to the smaller file size and minimal quality loss versus JPG or PNG.

A downside to working with WebP files is the lack of thumbnail support in Nautilus (also known as GNOME Files).

Fortunately, it’s easy to add support, by installing webp-pixbuf-loader. webp-pixbuf-loader can be found on GitHub.

It’s available in most Linux distributions, though the naming is not always consistent. For example, in the main Gentoo repos, the package is called gdk-pixbuf-loader-webp.

Once installed, simply log out and back in, and your system will start generating WebP thumbnails.

Cleaning Up Old Thumbnails

When Nautilus fails to generate a thumbnail, it generates an entry in ~/.cache/thumbnails/fail. This prevents the system from continually attempting to generate missing thumbnails if it is unable to do so.

This will prevent existing WebP files from having a thumbnail generated for them. If you have existing WebP files, be sure to delete the contents of this file to allow thumbnails to be generated.

In addition, prior to using this package, solutions to adding WebP thumbnails usually involved adding a file to /usr/share/thumbnailers. This file would contain code such as

[Thumbnailer Entry]
Exec=/usr/bin/dwebp %i -scale 100 100 -o %o
MimeType=image/x-webp;image/webp;

If you have thumbnails generated using this method, delete this file from /usr/share/thumbnailers. You’ll also want to delete ~/.cache/thumbnails, to ensure any thumbnails generated using this method are removed.

This is especially important if you used the exact code above, which set all generated thumbnails to 100×100 pixels. webp-pixbuf-loader will create thumbnails of the correct aspect ratio – but only if they don’t already exist.

If you like what we do, consider supporting us on Ko-fi