DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

John has posted 2 posts at DZone. View Full User Profile

Convert Canon RAW ( .CRW) To Jpeg

06.27.2008
| 9188 views |
  • submit to reddit
        This is adapted from http://www.howtofixcomputers.com/forums/digital-photo/my-humble-contribution-wrapper-script-dcraw-linux-4360.html to enable (I think) higher quality interpolation in dcraw and higher quality JPEGs.

DCRAW="dcraw -w -c "
while [ $# -ge 1 ]
do
OJPEG=$(echo $1| perl -pe 's/\.crw$//i' | tr 'A-Z' 'a-z')'.jpeg'
echo "${DCRAW} $1 | cjpeg > ${OJPEG}"
${DCRAW} -q 3 $1 | cjpeg -quality 95 > ${OJPEG} || echo " *PROBLEM*"
# transfer EXIF data from the original raw file
exiftool -overwrite_original -TagsFromFile "$1" "${OJPEG}" >/dev/null
# preserve timestamps as much as possible
# touch -r "$1" "${OJPEG}"
dcraw -z "${OJPEG}"
shift
done