Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Decode RAW files form camera using darktable-cli + XMP to JPEG
#!/bin/bash -eu
for XMP_FILE in *.xmp; do
RAW_FILE=`awk -F \" '/xmpMM:DerivedFrom=/ { print $2 }' $XMP_FILE`
RAW_FILE_NAME="${XMP_FILE%.*}"
FILE_NAME="${RAW_FILE%.*}"
echo "*** $XMP_FILE [$RAW_FILE] [$FILE_NAME]"
if [ "$RAW_FILE_NAME" != "$RAW_FILE" ]; then
echo "Raw file name mentioned in xmp (xmpMM:DerivedFrom) file doesn't match the raw file taken from \"$RAW_FILE_NAME\" !"
exit 1
fi
test -f $RAW_FILE || ( echo "$RAW_FILE does not exists !"; exit 2 )
test -f "${FILE_NAME}.jpg" && rm -v "${FILE_NAME}.jpg"
darktable-cli --verbose "${RAW_FILE}" "${XMP_FILE}" "${FILE_NAME}.jpg" --core --conf plugins/imageio/format/jpeg/quality=80
# darktable-cli --verbose --width 1920 "${RAW_FILE}" "${XMP_FILE}" "${FILE_NAME}.jpg" --core --conf plugins/imageio/format/jpeg/quality=98
exiftool '-filename<CreateDate' -d %Y%m%d-%H%M%S%%-c.%%le "-filemodifydate<datetimeoriginal#" "${FILE_NAME}.jpg"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.