Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmassuchetto/1c11a671f890a770a7a030c06d9f1f7e to your computer and use it in GitHub Desktop.
Save vmassuchetto/1c11a671f890a770a7a030c06d9f1f7e to your computer and use it in GitHub Desktop.
Regenerate Shotwell thumbnails in parallell processing
#!/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