Skip to content

Instantly share code, notes, and snippets.

@benjaoming
Last active April 10, 2017 01:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benjaoming/097f09557c077c09497b to your computer and use it in GitHub Desktop.
Save benjaoming/097f09557c077c09497b to your computer and use it in GitHub Desktop.
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