Skip to content

Instantly share code, notes, and snippets.

@artoliukkonen
Created September 18, 2019 12:21
Show Gist options
  • Save artoliukkonen/3b0d6fb46dd4321376fc534581502e56 to your computer and use it in GitHub Desktop.
Save artoliukkonen/3b0d6fb46dd4321376fc534581502e56 to your computer and use it in GitHub Desktop.
Script to create 2000x thumbnails from Canon RAW images, and store those in same hierarchy under "thumbs" folder. Also preserves metadata info from original RAW.
#!/bin/sh
set -e
cd /mnt/usb/
for d in */; do
echo $d
if [ ! -d "$d/thumbs" ]; then
echo "generating thumbs"
exiftool -b -PreviewImage -w "$d/thumbs/%f.jpg" -ext CR2 -r "$d"
exiftool -tagsfromfile "$d/%f.CR2" -all:all -r -overwrite_original -ext jpg "$d/thumbs"
mogrify "$d/thumbs/*.jpg" -resize 2000x "$d/thumbs/*"
else
echo "has thumbs, skipping"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment