Forked from benjaoming/shotwell_regenerate_thumbnails.sh
Last active
April 10, 2017 04:12
-
-
Save vmassuchetto/1c11a671f890a770a7a030c06d9f1f7e to your computer and use it in GitHub Desktop.
Regenerate Shotwell thumbnails in parallell processing
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 | |
THUMB_ROOT=~/.cache/shotwell/thumbs | |
MAX_PROCESSES=4 | |
i=0 | |
sqlite3 ~/.local/share/shotwell/data/photo.db \ | |
"select id||' '||filename from PhotoTable order by exposure_time desc" | | |
while read id filename; do | |
let i++ | |
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 "Generating thumb for $filename"; | |
convert "$filename" -quality 60 -auto-orient -thumbnail 128x128 $tf1 & | |
convert "$filename" -quality 60 -auto-orient -thumbnail 360x360 $tf2 & | |
if [ $(($i % (MAX_PROCESSES/2))) == 0 ] | |
then | |
wait | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment