Last active
October 19, 2021 20:39
-
-
Save greg-randall/46915d9cdd581b0c714c1d6d2b2a0acb to your computer and use it in GitHub Desktop.
Generate quick small thumbnails from a folder of raw files using DCRAW, ImageMagick, and cjpeg.
This file contains 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 | |
if [ ! -d "../thumb" ] | |
then | |
mkdir ../thumb | |
fi | |
for i in * | |
do | |
if [[ $i == *.RWZ ]] || [[ $i == *.RW2 ]] || [[ $i == *.CR2 ]] || [[ $i == *.DNG ]] || [[ $i == *.ARW ]] || [[ $i == *.ERF ]] || [[ $i == *.NRW ]] || [[ $i == *.RAF ]] || [[ $i == *.NEF ]] || [[ $i == *.K25 ]] || [[ $i == *.DNG ]] || [[ $i == *.SRF ]] || [[ $i == *.EIP ]] || [[ $i == *.DCR ]] || [[ $i == *.RAW ]] || [[ $i == *.CRW ]] || [[ $i == *.3FR ]] || [[ $i == *.BAY ]] || [[ $i == *.MEF ]] || [[ $i == *.CS1 ]] || [[ $i == *.KDC ]] || [[ $i == *.ORF ]] || [[ $i == *.ARI ]] || [[ $i == *.SR2 ]] || [[ $i == *.MOS ]] || [[ $i == *.MFW ]] || [[ $i == *.CR3 ]] || [[ $i == *.FFF ]] || [[ $i == *.SRW ]] || [[ $i == *.J6I ]] || [[ $i == *.X3F ]] || [[ $i == *.KC2 ]] || [[ $i == *.RWL ]] || [[ $i == *.MRW ]] || [[ $i == *.PEF ]] || [[ $i == *.IIQ ]] || [[ $i == *.CXI ]] || [[ $i == *.MDC ]] | |
then | |
new_file_name=$(sed 's/ /_/g' <<< "${i%.*}_thumb.jpg") | |
dcraw -e -c $i | convert - -quiet -thumbnail 1600\> -auto-gamma -auto-level -normalize -quality 100 - | cjpeg > ../thumb/$new_file_name | |
echo "$i thumb created" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment