Adding leading and trailing space to text

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
donnied
Posts: 3
Joined: 2009-01-04T18:04:29-07:00

Adding leading and trailing space to text

Post by donnied »

I have text that I would like to graphics from.
The basic command is:

Code: Select all

convert -background "#FFCC99" -fill '#993333' -pointsize 11 -font Verdana-Regular -size 200x14  label: "foo" foo.png
I had hoped to adjust the positioning of the text within the field similar to gravity but with explicit instructions e.g. shift right this number of points and shift up this number of points.

I thought possibly with the geometry offset option; however, I didn't have much success with that.

I would like to specify leading points. How can I do that?

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

Re: Adding leading and trailing space to text

Post by fmw42 »

see http://www.imagemagick.org/Usage/text/#attributes

for kerning, interword spacing, etc
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Adding leading and trailing space to text

Post by anthony »

Try creating a label of the point size wanted without any size. Now Extent the image appropriately

Two ways. Set a virtual canvas size and offset wanted, then use -flatten

Code: Select all

convert label:Anthony -repage 100x100+20+20 -flatten show:
The other is use -extent but with a negative offset (gravity can also be used)

Code: Select all

   convert label:Anthony   -extent 100x100-20-20  show:
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply