Skip to content

Instantly share code, notes, and snippets.

@bhcopeland
Created January 26, 2014 16:26
Show Gist options
  • Save bhcopeland/8635239 to your computer and use it in GitHub Desktop.
Save bhcopeland/8635239 to your computer and use it in GitHub Desktop.
Simple script that uses ufraw-batch to convert CR2 (raw) images into JPG.
#!/bin/bash
######################
##Simple script that uses ufraw-batch to convert CR2 (raw) images into JPG.
##Place the script inside /usr/bin/cr2tojpg
##Usage: cr2tojpg /your/image/location
##Ben Copeland 2014 https://github.com/bhcopeland 26/01/14
#######################
cd $1
if [[ -z "$1" ]]; then
echo "set a directory"
else
if [ -d $1 ]; then
if [ ! -d ./processed_images ]; then mkdir ./processed_images; fi;
# processes raw files
for f in *.CR2 *.cr2;
do
echo "Processing $f"
ufraw-batch \
--wb=camera \
--exposure=auto \
--out-type=jpeg \
--compression=96 \
--out-path=./processed_images \
$f
done
cd ./processed_images
#change the image names
for i in *.jpg;
do
mv "$i" "${i/.jpg}"_r.jpg;
done
for i in *.jpg;
do
mv "$i" "${i/imgp/_igp}";
done
else
echo "not a directory"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment