Ubuntu – How to make Shotwell regenerate all the thumbnails

shotwellthumbnails

For some unknown reason all thumbnails are lost in my Shotwell, instead all icons are grey. The images themselves are all okay and I can open them all in Shotwell.

There are only empty folders in .shotwell/thumbs/ so it looks like the thumbnails don't doesn't get generated at all.

I have also tried to re-install Shotwell (by purge it first) without any change.

How do I make Shotwell regenerate all the thumbnails?

Best Answer

This shell script will regenerate your thumbnails of sizes 128px and 360px so you'll see at least something in viewer.

sqlite3 ~/.local/share/shotwell/data/photo.db \
  "select id||' '||filename from PhotoTable order by timestamp desc" | 
  while read id filename; do
    for size in 128 360; do
      tf=$(printf ~/.cache/shotwell/thumbs/thumbs${size}/thumb%016x.jpg $id);
      test -e "$tf" ||  {
        echo -n "Generating thumb for $filename ($tf)";
        convert "$filename" -auto-orient -thumbnail ${size}x${size} $tf
        echo
      }
    done
  done