From d730ccd23da2785ced5d9bb0f313ca6e029bd1c5 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sun, 16 Aug 2015 17:17:35 +0200 Subject: [PATCH] Added tool to copy metadata. --- copy_exif.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 copy_exif.sh 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