Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Regenerate Shotwell Thumbnails
#!/bin/bash
# Based on http://gagor.pl/2014/01/regenerate-thumbnails-in-shotwell-for-last-month/
THUMB_ROOT=~/.cache/shotwell/thumbs
# Remove " > date('now','start of month','-1 month')" if you want to re-generate everything
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 $THUMB_ROOT/thumbs128/thumb%016x.jpg $id);
tf2=$(printf $THUMB_ROOT/thumbs360/thumb%016x.jpg $id);
if [ -e "$tf1" ]
then
echo "Skipping $filename"
else
echo -n "Generating thumb for $filename";
#echo $tf1
convert "$filename" -quality 60 -auto-orient -thumbnail 128x128 $tf1
convert "$filename" -quality 60 -auto-orient -thumbnail 360x360 $tf2
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment