Text Positioning

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
Neko

Text Positioning

Post by Neko »

Hi,

I need a bit help with text positioning in y-dimension. I read somewhere ImageMagick uses the baseline of the text for positioning text in that dimension, is that confirmed? I need to position some text centered to other graphic objects and tried it by gathering the data via QueryFontMetrics, but obviously there's no data in the output how the baseline is related to the image height or did I miss something?

Any helpful thoughts on this?

Thanks
Neko

Re: Text Positioning

Post by Neko »

Ok, maybe the question was to specific. Can anyone tell me in the first place where the 'anchor' (as in the coordinates that are given to annotate) in relation to the text is exactly?

Second question is then how do you align text centered (between to lines for example) in the y-direction.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Text Positioning

Post by Bonzo »

You can use -gravity Center -annotate +0+0 and modify the position with the +0+0

Or you can use -draw \"gravity center fill black text 0,0 and modify the position with the 0,0

Some examples here: http://www.rubblewebs.co.uk/imagemagick/text.php

Have you checked out Anthonys examples ?
http://www.imagemagick.org/Usage/
Post Reply