Page 1 of 1

Determine "bounding box" of -annotate command?

Posted: 2009-04-14T09:51:32-07:00
by webunity
Is it possible to get the bounding box of the text written using annotate?

For instance, i want to use imagemagick to create headers (or menu images) for my sites. Dynamically, based on CMS input.

Right now i have this:

Code: Select all

convert 'basel1.gif' -fill white -font verdana.ttf -pointsize 10 -gravity north -annotate +0+0 'HOME' Label_IM.jpg
Which basically tells it:
Take baseL1.gif, Write some text using a white font and the Verdana font with pointsize 10.

So far so good, but how do i know the width/height of the written text, is it possible to retreive that information?

Re: Determine "bounding box" of -annotate command?

Posted: 2009-04-14T10:47:34-07:00
by fmw42
Have you tried -debug annotate. See http://www.imagemagick.org/Usage/basics/#controls

also see

viewtopic.php?f=1&t=13427&hilit=debug+annotate

Don't know if that helps or not?

Often I will use label: to make a test image to find out how big it is, then redo it with -annotate.

see
http://www.imagemagick.org/Usage/text/#label
http://www.imagemagick.org/Usage/text/#annotate_size

Re: Determine "bounding box" of -annotate command?

Posted: 2009-04-14T11:05:27-07:00
by webunity
@fmw42: Thanx! I have to use an older version so i got it working by doing this:
http://www.imagemagick.org/Usage/text/#font_info
convert -size 250x250 xc:lightblue -gravity north-west -font verdana.ttf -pointsize 9 -fill none -undercolor white -annotate +0+0 'WebUnity' -trim info: