Page 1 of 1

ImageMagic commands help

Posted: 2011-08-16T23:56:34-07:00
by vin_akleh
i am new to this ImageMagic thing.
i have this command

Code: Select all

convert -font $arial \(  \( -pointsize 14 -fill black -gravity south label:\"Scan or \" +append \( $overlay  -scale 90x90 \) -gravity south -append \( -background white   \( -pointsize 44   -fill black -gravity southeast  label:\" text \nto \"  -fill $textColor -font $arialBold  -gravity southwest label:\" $keyword\n 467467 \" -scale 60%x90%  -bordercolor white -border 0x10 \) \) -gravity North +append \(  -fill black -font $arial -gravity West -pointsize 8.5 -draw \"text 130,48 ' MSG & Data rates may apply.'\" \) -append  \)     \) -resize 530x120 -gravity center -extent 100%x120 -density 600 -sigmoidal-contrast 10x69% $tempFile -resize 530x120 $tempFile1"
what i need to do is like so:


_scan__ or
"image" text "sometext"
________to__467467

and not like so:

_scan or
"image" text "sometext"
_______to____467467

i need the "or" over the "text" and not over the image as it is in this command, any body have any ideas (note the "_" is space character)

Re: ImageMagic commands help

Posted: 2011-08-18T17:48:41-07:00
by anthony
You will need to use a fixed width font so spaces and characters are all the same width.
alternativally you will need to position individual words.
Getting the width of individual words can be done by retrieving font metrics...
http://www.imagemagick.org/Usage/text/#font_info

For example by getting the width of the strings '"image" ', '"image" text', and 'or' in the font/density/pointsize you plan to use, will let you calculate the exact X offset needed to center the 'or' word over the 'text' word! (at least to the nearest integer pixel)


Note that IM is not a Word processor, but a Image processor. Using the right tool (such as TeX which can handle text positioning, spacing etc) is always a better option. For other options see...
http://www.imagemagick.org/Usage/text/#tex