diff --git a/copy_exif.sh b/copy_exif.sh new file mode 100755 index 0000000..a0e2718 --- /dev/null +++ b/copy_exif.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# @author Markus Birth +# Syntax: ./copy_exif.sh imagefile1 imagefile2 +# Copies EXIF/XMP metadata from imagefile1 to imagefile2 +# Needs: exiv2 + +if [ -f "$1" -a -f "$2" ]; then + BASENAME_1=`echo "$1" | sed -nre 's/^(.*)\.[^.]+$/\1/p'` + BASENAME_2=`echo "$2" | sed -nre 's/^(.*)\.[^.]+$/\1/p'` + exiv2 ex "$1" + mv "$BASENAME_1.exv" "$BASENAME_2.exv" + exiv2 im "$2" + rm "$BASENAME_2.exv" +else + echo "Syntax: $0 [source file] [target file]" + echo " Will copy metadata from first to second file." +fi