Last active
January 8, 2019 04:35
-
-
Save jackdpeterson/eef8b086b2eed16796ac310f66d5b9aa to your computer and use it in GitHub Desktop.
bash script to recursively convert RAW to JPEG retaining directory structure.
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 | |
src_dir=$1 | |
src_dir_length=${#src_dir} | |
dest_dir=$2 | |
file_type="ARW" | |
### let's use ufraw-batch. This assumes that you've compiled to the latest ... 0.22 as of this one doesn't cause crappy weirdness with red-spots appearing with under-exposure. | |
# Usage: ./convert_raw_to_jpeg.sh /source/folder /destination/folder | |
# | |
### | |
if [ ! -d "${src_dir}" ]; then | |
echo "provided source directory is not a dir" | |
exit 2 | |
fi | |
if [ ! -d "${dest_dir}" ]; then | |
echo "provided destination directory is not a valid directory!" | |
exit 2 | |
fi | |
find ${src_dir} . -type f -name "*.${file_type}" | while IFS= read -r src | |
do | |
dst=$(echo "${dest_dir}/${src#$src_dir/}") | |
dst_dir=$(dirname ${dst}) | |
mkdir -p $(dirname "$dst") | |
cmd=$(echo "ufraw-batch --wb=camera --exposure=auto --out-type=jpeg --compression=100 --exif --rotate=camera --overwrite --out-path=${dst_dir} ${src}") | |
echo performing ${cmd} | |
$(${cmd}) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sweet utility, thanks for sharing.