1

I read Where are icons stored? about the location of Ubuntu built-in icons (for instance /usr/share/icons/gnome/256x256/appsgnome-terminal.png).

But I am confused about the icon location of a new image, for instance. Let's say I have in a specific directory, a very large .eps or .bmp file and I would like to know where its icon(s) is/are located (if somewhere) and how I can access it/them.

karel
  • 122,292
  • 133
  • 301
  • 332

1 Answers1

6

Depending on the programm that processes the thumbnails, the "icons" are usually located either in ~/.thumbnails/ or ~/.cache/thumbnails/.

The file name of the thumbnail is the md5sum of the full path + .png extension. So for finding the thumbnail of a given file you can use this function:

find_thumbnail(){
    full_path="file://$(realpath -s "$1")"
    md5name=$(printf %s "${full_path// /%20}" | md5sum)
    find ~/.thumbnails/ ~/.cache/thumbnails/ -name "${md5name%% *}.png"
}


Usage:
======
find_thumbnail /path/to/file.bmp
find_thumbnail ~/Pictures/file.jpg
find_thumbnail file.jpg
find_thumbnail "file with spaces.tif"
pLumo
  • 27,991