Page 1 of 1

Annotating photographs

Posted: 2015-06-29T20:53:17-07:00
by schievelbein
I am using ImageMagick 6.7.7-10 on Linux Mint 17 to annotate many 1000s of genealogy photographs.
I have developed the following script, but it still has a bunch of problems that I am hoping someone can help with.

Code: Select all

cwidth=`identify -format "%[fx:w]" $1`;
cheight=`identify -format "%[fx:h/20]" $1`;
cdate=`identify -format %[Date:exif:DateTimeOriginal] $1`;
cdesc=`identify -format %[IPTC:2:120] $1`;
convert $1 -gravity South -splice 0x${cheight} annotated_$1
convert -background white -fill black -gravity center -size ${cwidth}x${cheight} caption:"$cdate $cdesc" annotated_$1 +swap -gravity south -composite annotated_$1
The code takes the DATE and COMMENT from a jpg and uses it to create an ANNOTATION at the bottom of the photo on an extended canvas area.
The problems are:
1. The current script sometimes takes minutes to run, is there anything in my script that I could change to speed it up?
2. Is there any way to use Mogrify instead of convert so that it will overwrite the file and I do not have to do renames?
3. Is there any way to make all of this one command so that I could use it within FotoXX and similar interfaces?

Any and all suggestions or criticism is welcomed.

Re: Annotating photographs

Posted: 2015-06-29T21:23:46-07:00
by fmw42
6.7.7.10 is ancient (140 versions old). upgrade.

You cannot make it all one command. All the variable calculations can be made into one command. The convert commands can be combined by using parenthesis processing. See http://www.imagemagick.org/Usage/basics/#parenthesis.

Mogrify takes one image and makes one output only for each image in the folder. However, one can do composites using -draw, but the image must exist already. You cannot use parentheses in mogrify. See http://www.imagemagick.org/Usage/basics ... fy_compose. So it would only be of use if you have the same overlay image (or the same background image) for every image in your folder.

Re: Annotating photographs

Posted: 2015-06-29T23:25:17-07:00
by snibgo
You run identify four times, reading the image file four times. You could do this just once:

Code: Select all

read cwidth cheight cdate cdesc <<< $( identify -format "%w %[fx:h/20] %[Date:exif:DateTimeOriginal] %[IPTC:2:120]" %1 )