Quick and dirty batch script to watermark and add IPTC data to a set of files in the supplied dir to
#!/bin/bash
# Copyright Andy Wright - www.litost.org 2006.
# You have permission to do what you want with it as long as you don't
# blame me if it insults your mother etc. :).
# Std disclaimers apply.
# Quick and dirty batch script to watermark and add IPTC data to a set of
# files in the supplied dir to <supplied>-Copyright</supplied>.
# Needs:
# ImageMagick - http://www.imagemagick.org/
# Exiv2 - http://www.exiv2.org/
CopyrightStr="Copyright String"
CreditStr="Credit String"
Exiv2=/usr/local/exiv2/bin/exiv2
Composite=/usr/bin/composite
CopyrightImg=Copyright.png
Quality=96
inDir=$1
[ -z "$inDir" ] && cat < < EOF && exit 1
Add watermark and IPTC data to all the files in <indir> -> </indir><indir>-Copyright
Warning probably only works on relative directories.
Usage: $0 </indir><indir>
EOF
outDir=$inDir-Copyright
test -d $outDir || mkdir $outDir
renice 15 -p $$
for file in $(ls -1 $inDir/*.{jpg,JPG} | sed -e "s/^$inDir\///")
do
infile=$inDir/$file
outfile=$outDir/$file
echo "Adding IPTC data to $file"
$Exiv2 -M"set Iptc.Application2.Copyright String $CopyrightStr" $infile
$Exiv2 -M"set Iptc.Application2.Credit String $CreditStr" $infile
$Exiv2 -M"set Iptc.Application2.TransmissionReference String $file" $infile
echo "Copyrighting $file"
$Composite -quality $Quality -gravity southeast $CopyrightImg $infile $outfile
done</indir>