I love Shotwellexternal link for it’s simplicity and easy export to Piwigoexternal link . After Christmas I added new photos to my library but after that I made some modifications to them (red eye reduction, etc…). Because Shotwell generate thumbnails only on import, all my modifications were not visible on preview.

I’ve started searching how to regenerate thumbs and found this infoexternal link . There were two issues with this method:

  • this howto was for old version (with old paths) and only for 128px thumbs
  • I definitely don’t want to regenerate thumbnails for 40k photos!

After some tweaking this will do work for thumbnails from last month (enough for me):

sqlite3 ~/.local/share/shotwell/data/photo.db \
  "select id||' '||filename from PhotoTable where date(timestamp,'unixepoch','localtime') > date('now','start of month','-1 month') order by timestamp desc" |
while read id filename; do
  tf1=$(printf ~/.local/share/shotwell/thumbs/thumbs128/thumb%016x.jpg $id);
  tf2=$(printf ~/.local/share/shotwell/thumbs/thumbs360/thumb%016x.jpg $id);
  test -e "$tf" ||  {
    echo -n "Generating thumb for $filename";
    convert "$filename" -auto-orient -thumbnail 128x128 $tf1
    convert "$filename" -auto-orient -thumbnail 360x360 $tf2
    echo
  }
done

Remember to install imagemagick:

apt-get install imagemagick