Last active
April 10, 2017 01:56
-
-
Save benjaoming/097f09557c077c09497b to your computer and use it in GitHub Desktop.
Regenerate Shotwell Thumbnails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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