my-scripts/write-exif-comment.sh

27 lines
924 B
Bash
Executable file

#!/bin/bash
# Write a exif-comment to all JPEG-Files from this directory and all subdirectorys
#
# (c) LUG-VS (GPL)
VERSION="write-exif-comment.sh Version 0.0.1 from 16.06.2019"
#
# Input: InImage [OutImage]
# Output: changed files
#
# Changes:
# 0.0.1: generation
#
test -e $1 || exit -1
FilenameFull="$1"
if [ $# -gt 1 ] ; then
FilenameSik="$2"
else
Extension="${FilenameFull##*.}"
FilenameBase="${FilenameFull%.*}"
FilenameSik="${FilenameBase}New.${Extension}"
fi
CommentsText="$(convert ${FilenameFull} -format "%c\n" info:)"
Width=$(identify -format %w ${FilenameFull})
High=$(( $(identify -format %h ${FilenameFull}) / 10))
echo "EXIF-Kommentar= <${CommentsText}> of <${FilenameFull}> (${Width}x${High} ${FilenameSik})"
convert -background '#0008' -fill white -gravity center -size ${Width}x${High} caption:"${CommentsText}" \
${FilenameFull} +swap -gravity south -composite ${FilenameSik}