On Ubuntu ( Budgie ) 20.04 when using Gimp as a snap, you’ll see thumbnails for .xcf files only « inside » Gimp and nowhere else ( Nemo, Nautilus, gThumb… )

1⋅ how tell my session to look for thumbnails not only in ~/.cache/thumbnails/ but also in any thumbnails folder inside ~/snap/ ?

2⋅ reading again snap doc I wonder if https://snapcraft.io/docs/thumbnailer-service-interface might be the answer. Should I connect that interface to Gimp ? Or doesn’t it do what I’m looking for ?

An answer to 1⋅ may solve the issue for any snap app eventually generating thumbnails.

Comes in 2⋅ is not what I expected.

For references : https://forum.ubuntu-fr.org/viewtopic.php?id=2053949https://forum.snapcraft.io/t/gimp-and-thumbnails-for-xcf-files/18131https://discourse.ubuntubudgie.org/t/gimp-as-a-snap-no-thumbnails-for-xcf-files-in-nemo-gthumb/3799

2 Answers 2


Thumbnails improve efficiency. Having to open big XCF files each time to see their current status is a torture.

The thumbnailer-service interface may be the solution, but it seems one needs to be implemented and maintained for XCF thumbnails. As none seems to exists. To avoid having to write one, I'm looking for a simpler and faster to implement temporal solution.

The proposed solution of symlink the whole thumbnail/normal directory to the one inside ~/snap directory works, and each time you open and save a XCF file with GIMP, the thumbnail gets auto updated.

If, like my, you don't want to symlink the whole directory, I propose this other temporal solution: symlink individual thumbnails by mean of a Nautilus script. Note: requires to run the script for newly created XCF files, while already existing files will get their thumbnails auto updated.

The script:


for file in ~/snap/gimp/common/.cache/thumbnails/normal/*
    if [ -f $file ]
        ln -s "$file" ~/".cache/thumbnails/normal/$(basename $file)"

You can do the same for the thumbnails/large directory if needed.

Save to Nautilus script folder and you can run it every time you see XCF files without thumbnails. Recommended name "Update Thumbnails", no need for .sh extension, but turning on executable bit in file permissions is required.

The ln command will just fail without harm when the symlink already exists.

Also, by using script-fu, it is possible to make gimp generate 128x128 PNG files, and save them to ~/.cache/thumbnails/normal directory, from command line and without loading its interface.

But, while the following works:

$fileshort=$(basename "$file")
uri=$(urlencode -m "$fileshort") # urlencode requires install
thumbfilename=$(echo -n "$uri" | md5sum | awk '{print $1}')

gimp -i -b "(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"$file\" \"$file\")))
(drawable   (car (gimp-image-active-drawable image)))
(cur-width  (car (gimp-image-width image)))
(cur-height (car (gimp-image-height image)))
(ratio      (min (/ 128 cur-width) (/ 128 cur-height)))
(width      (* ratio cur-width))
(height     (* ratio cur-height))

(gimp-image-scale image width height)
(file-png-save RUN-NONINTERACTIVE image drawable \"$thumbfilename\" \"$thumbfilename\" 0 9 1 1 1 1 1)
(gimp-image-delete image)
)" -b "(gimp-quit 0)"

You need to give a value to $file somehow. For example, by iterating a directory.

The generation of a valid thumbnail name depends on urlencode command, that's not present by default.

A valid thumbnail name is the result of obtaining the md5 hash of the filename in URI form "file://" and appending the png extension to it.

The thumbnails won't auto update, having to run the script manually each time you want them to update.

There is the gimp-file-save-thumbnail command for script-fu, but I had no luck with it. I didn't find the resulting thumbnail in my filesystem and the command doesn't seem to return anything.

Ideal solution: a GIMP extension that is aware that GIMP was installed by snap and saves thumbnails to ~/.cache/thumbnails/normal each time you update an XCF file.

The problem: with script-fu may not be possible. As far as I know, those scripts needs to be invoked. You can register them as a menu item inside GIMP's interface, but you cannot have one reacting to file open or file save events.

Other possible solutions are:

Having a background bash or Python script monitor recently modified directories, and scanning them for XCF files. The script-fu above can be invoked to generate the thumbnails without showing the GIMP interface.

Challenge is to do it in the most optimal possible way.


Those were brilliant suggestions.

I have finally ended up with binding both « thumbnails » folders through fstab adding those lines :

# .xcf thumbnails from gimp snap for anyone
/home/user_1/.cache/thumbnails/ /home/user_1/snap/gimp/common/.cache/thumbnails/    none    bind    0   0
/home/user_2/.cache/thumbnails/ /home/user_2/snap/gimp/common/.cache/thumbnails/    none    bind    0   0
/home/user_3/.cache/thumbnails/ /home/user_3/snap/gimp/common/.cache/thumbnails/    none    bind    0   0

This way, Gimp-snap actually writes its thumbnails there and then Nemo and Nautilus accordingly displays thumbnails for .xcf files.

gThumb though still shows empty frames for .xcf files - but my main concern was the file explorer.

Thanks to https://forum.ubuntu-fr.org/viewtopic.php?pid=22362050#p22362050

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.