Limit maximum thumbnail size in Dolphin

I want Dolphin to stop creating x-large and xx-large thumbnails, and use upscaled large when I increase thumbnails size while using it.

I’ve switched to KDE recently and first thought was is that Dolphin is quite pleasant to use to browse image collection. I like how you can change size of previews with Ctrl+mouse wheel from very small to very large.

Then, I’ve found where Dolphin keeps generated thumbnails and checked size of these directories in Powershell:

gci  ~/.cache/thumbnails/ | % {
$dir = $_
gci -Recurse $dir | Measure-Object Length -Sum | % { Write-Host $dir $_.Count ([int]($_.Sum/1mb)) mb }
}

/home/user/.cache/thumbnails/large 455 31 mb
/home/user/.cache/thumbnails/normal 461 8 mb
/home/user/.cache/thumbnails/x-large 9840 2476 mb
/home/user/.cache/thumbnails/xx-large 2424 1656 mb

I haven’t used Dolphin a lot yet, but it already generated 4gb of thumbnails. Not cool. I’d like to limit disk usage of this feature.

I want Dolphin to stop creating x-large and xx-large thumnbails, and use large instead. No need to limit maximum visible size of thumbnails, large can be upscaled. It will introduce pixelation, but it’s ok because task of previews is to give idea of file contents and 256px is enough for that.

It would make it possible to drastically decrease disk usage and will add more control over this disk intensive feature.

I found this topic is related: Dolphin feature request; Flexible thumbnail size. • KDE Community Forums

I believe what I want is not possible right now?

As far as I am aware (and I have been searching!) there is currently nothing in the way of configuring thumbnail creation, other than the “Preview Settings” page in “Configure Dolphin”. In fact, I started a similar thread a few days ago, which at its core is also about wanting more control over how thumbnails get created, but it has not gotten any replies yet.

If your main problem is about wasted space, you could do some of the workarounds I did:

  • mounting ~/.cache/thumbnails to a ram disk, which is one line in /etc/fstab:
    tmpfs /home/username/.cache/thumbnails tmpfs defaults,noatime,uid=username,gid=username,mode=1700 0 0
    This way they will automatically be gone after you shutdown and not be saved to disk at all
  • automatically deleting thumbnails some time after they get created, which is one line to add in $ crontab -e:
    0 * * * * find /home/username/.cache/thumbnails/ -mmin +240 -delete

Of course, neither of those “hacks” will prevent the thumbnail service to use cpu power on creating the thumbnails, or rather, this probably will use more cpu because thumbnails will have to be recreated after being removed, but it’s the best I could come up with so far.

One heads-up, though, dolphin is not the only application creating files in these folders, it’s a whole specification that, in theory, should make it so thumbnails can be shared between multiple applications (Thumbnail Managing Standard). This also means other applications might be responsible for creating these files, though.

1 Like

You could also look into systemd-tmpfiles for something in between a normal directory and tmpfs based cache: