The GNU Image Manipulation Program (GIMP) is an amazing image editor. I’ve used GIMP at The Working Centre’s Computer Recycling Project ever since I started volunteering for the project back in November of 2001. GIMP is one of the programs in Xubuntu that can open images ending in the .webp extension.
Webp is a format developed by Google that was intended to replace jpg, png, and gif formats. Development first started in 2010, and evolved over the years to include features such as lossless and lossy compression, animation, and alpha transparency (Wikipedia: Webp). The first stable version of the webp library was released in 2018, so it’s still a relatively new format.
In terms of animations, webp is better than gif, as webp supports 24bit colours, compared to the 8bit colour support of the gif file format.
What I like about the webp format is that images have a smaller file size than png or jpg and still look amazing.
Unfortunately, support for webp in Xubuntu is lacking compared to jpg, png, or gif. Although the webp format is supported by 96% of the web browser share, it’s still a relatively new format, so it may take some time for software developers to add native webp support.
How to add Thunar and Ristretto support for webp
When an image is saved with the webp extension in GIMP, Thunar file manager, the default file manager in Xubuntu, displays an icon for the saved graphic. Thunar is capable of displaying previews for most graphical formats, jpg, png, and gif, but by default it isn’t capable of previewing webp.
If you try to open a webp image it will likely open with a web browser, rather than an image viewer or editor. This makes a bit of sense since webp is designed for web use. But to me it makes more sense to open image files with the default image viewer in Xubuntu/XFCE, Ristretto. Ristretto, as configured in Xubuntu 22.04 (and earlier) does not support opening webp images.
It’s possible to fix both issues, displaying previews in Thunar, and adding webp viewing support to Ristretto in Xubuntu 22.04, by installing one library:
sudo apt update && sudo apt install webp-pixbuf-loader
The first part of this one liner updates the list of packages available to Xubuntu from the online repositories. The second part of the one liner, after the &&, installs webp-pixbuf-loader, a library file that both Thunar and Ristretto use to display webp images.
Unfortunately the webp-pixbuf-loader isn’t available for Xubuntu 20.04. There is a webp package in Xubuntu 20.04, but it doesn’t seem to help either Ristretto or Thunar. I found a work around for Thunar in Xubuntu 20.04:
If you save a file as a webp image using GIMP, it won’t display the preview in Thunar under Xubuntu 20.04. But if you close GIMP, open the webp image in GIMP, then click the refresh window icon (right of the path field) in Thunar the webp image will display a preview. If the Thunar file manager is closed, then opened to the same directory/folder containing the webp image, it continues to display the preview. My guess is that when a webp image is opened by GIMP, GIMP creates a file somewhere on the system to allow previewing of the webp image. Unfortunately you have to do this process for each webp image, so it’s not as convenient as installing the webp-pixbuf-loader package.
This method also seems to work in Xubuntu 22.04.