Page 1 of 1

Multiple Lines Problem

Posted: 2010-05-30T13:27:32-07:00
by xypho
I am using ImageMagick (Version: ImageMagick 6.2.8 )

I am trying to write a script to simplify the creation of stamps. I need to be able to center multiple lines of text that have different font formatting settings that they will get from user input.

I was hoping to use something such as :

Code: Select all

convert -font helvetica -pointsize 25 label:'line 1' -font helvetica -pointsize 12 label:'line2' -gravity center -append test01.png
here is the result
Image

My text seems to justify to the left size. Is there an easy solution to fix this?

Thanks,
Xypho

Re: Multiple Lines Problem

Posted: 2010-05-30T14:28:44-07:00
by snibgo
It centres for me (IM 6.6.0-8). Try an upgrade.

Re: Multiple Lines Problem

Posted: 2010-05-30T14:42:38-07:00
by xypho
I am unable to update it's a godaddy shared server so my only hope is to get it to work with another means. Any ideas how to make it work in this version

Re: Multiple Lines Problem

Posted: 2010-05-30T15:42:24-07:00
by fmw42
append was only recently made gravity sensistive (v 6.4.8-2)

you will have to create two images and then composite them together to get them centered or possibly try montage with the two images.

Godaddy is the pits. I have tried numerous times to get them to upgrade IM or provide another current version, but they just ignore my request.

Re: Multiple Lines Problem

Posted: 2010-05-30T16:09:10-07:00
by fmw42
this seems to work for me

convert -font arial -pointsize 25 label:'line 1' -trim +repage tmp1.gif
convert -font arial -pointsize 12 label:'line2' -trim +repage tmp2.gif
montage tmp1.gif tmp2.gif -tile 1x -geometry +2+2 test01.png

Use the geometry to adjust the spacing between images and on its sides

Re: Multiple Lines Problem

Posted: 2010-05-31T11:29:02-07:00
by fmw42
this also works with one command line

montage -label "" \( -font arial -pointsize 25 label:'line 1' \) \
\( -font arial -pointsize 12 label:'line2' \) \
-tile 1x -geometry +0+5 test02.png


see discussion at viewtopic.php?f=3&t=16324

Re: Multiple Lines Problem

Posted: 2010-06-01T20:09:11-07:00
by anthony
Quote from IM examples, Layers Append...
Before IM v6.4.7 it was much more difficult to align appended images, and generally involved using a "-flop" for right alignment. Or using "-extent" or "-border" to adjust the image width for centered aligned appends.

For example, this will work with an older 6.3.2 version of IM...

Code: Select all

  convert rose:  -background SkyBlue label:Rose \
          -background White -gravity center -extent 200x \
          -append -trim +repage   append_center_old.jpg