Genealogist needs help

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
schievelbein
Posts: 12
Joined: 2013-10-24T11:34:48-07:00
Authentication code: 6789

Genealogist needs help

Post by schievelbein »

I am a genealogist with thousands of pictures that I need to annotate/label.
I have read most of the documentation and scoured the web, but I cannot figure this out.
I want to annotate each image with a text that is a combination of the DATE and the DESCRIPTION from the metadata.
The code that I am using works, to a certain degree

width=`identify -format %w $1`; montage -label "%[exif:DateTimeOriginal] %[IPTC:2:120]" -size %width -frame 5 -geometry +0+0 $1 annotated_$1

1) No matter what I do, the label always gets inserted in the images at the same font size. Sometimes it is so small that I have to zoom in to view it.
I thought that Montage was suppose to resize the font until it filled the width indicated?
2) The other limitation I want is to limit the height to %height*.1 so that the annotation area is not more that 10% of the height of the picture.
What I actually want is:
width=`identify -format %wX(%h*.10) $1`; montage -label "%[exif:DateTimeOriginal] %[IPTC:2:120]" -size %width -frame 5 -geometry +0+0 $1 annotated_$1

Thanks for your help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Genealogist needs help

Post by fmw42 »

As far as I know, montage does not respect -size. See http://www.imagemagick.org/Usage/montage/#settings for all the possible settings.

To make the font bigger use -pointsize. To make the image padding wider use -geometry. It does not seem to automatically expand the width past some nominal amount

Compare these:

montage -label "Text" -tile 1x1 -geometry +0+0 rose: show:

montage -label "Text" -tile 1x1 rose: show:

montage -label "This is some very very long text" -tile 1x1 rose: show:

montage -label "This is some very very long text" -pointsize 20 -geometry +200+0 -tile 1x1 rose: show:
schievelbein
Posts: 12
Joined: 2013-10-24T11:34:48-07:00
Authentication code: 6789

Re: Genealogist needs help

Post by schievelbein »

Thank you for the suggestions and directions to look.

I have modified my script and gotten the results I wanted, so I thought I would post the semi-final result.
I use this script within FotoXX after I modify the original photo and add the metadata including the date and description.
If I ever need to redo the annotation, I simply crop off the bottom and redo the script.
If anybody has any suggestions as how to speed this up or make the script smaller let me know.
I tried to do Mogrify for the last line with no success.
Thanks for all of the help.

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 test.jpg -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
Post Reply