#!/bin/bash # # By using ec (Exif comment), a shell script with GUI, you can adjust the comments # of your EXIF data to your own needs. # ec allows you to edit the comments in a batch mode, # which comes in quite handy when you want a specific comment to go along with your photos. # # ec was written by bernd essl # version 1.0 exiv2="/usr/bin/exiv2" file="/usr/bin/file" zenity="/usr/bin/zenity" function setError() { $zenity --error --text=$1 } function getDependencies() { if [ ! -e $1 ] then package=`echo $1 | sed 's@/usr/bin/@@g'` echo "You have to install the package \"$package\" first!" exit 1 fi } # check what we need getDependencies $exiv2 getDependencies $file getDependencies $zenity # comment-dialog comment=$($zenity --entry --title="Text for the comment" --text="Text for the comment:") if [ $? -eq 1 ] then exit 1 fi # picture-dialog pictures=$($zenity --file-selection --multiple); if [ $? -eq 1 ] then exit 1 fi IFS='|' for field in $pictures do # writeable? if [ ! -w $field ] then setError "$field not writeable!" continue fi # JPEG? if [ ! `$file $field | /bin/grep "JPEG image data"` ] then setError "$field doesn't look like a JPEG!" continue fi echo "write comment: \"$comment\" in file: \"$field\"" $exiv2 -M"set Exif.Photo.UserComment $comment" $field done | $zenity --progress --pulsate --auto-close $zenity --info --text="Done writing comments."