4

I am generating some buttons using ImageMagick. However, I am not able to set the spacing between the letters in generated image. Command which I use:

convert -gravity center button_subscribeme.png -font /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf  -fill white -draw "text 0,0 'CLICK ME'"  -font_stretch 10  render/mailbox-submit.png

throws:

convert: unrecognized option `-font_stretch' @ error/convert.c/ConvertImageCommand/1561.

So I guess font_strech is not proper option. How I can achieve it? Generated text is too narrow.

bluszcz
  • 4,054
  • 4
  • 33
  • 52

2 Answers2

8

There is no ImageMagick parameter named -font_stretch that I know of. However, there is -stretch.

But I don't think that -stretch really works with fonts. In any case, to find out what sort of values are possible, just run:

convert -list stretch

and see the result:

Any
Condensed
Expanded
ExtraCondensed
ExtraExpanded
Normal
SemiCondensed
SemiExpanded
UltraCondensed
UltraExpanded

Use -kerning !

Better use the -kerning commandline parameter. It takes positive as well as negative values:

convert \
  in.png \
 -gravity center \
 -font "/Library/Fonts/Arial Bold.ttf" \
 -kerning -0.5 \
 -fill white \
 -draw "text 0,0 'CLICK ME'" \
  out1.png

or

convert \
  in.png \
 -gravity center \
 -font "/Library/Fonts/Arial Bold.ttf" \
 -kerning 1.5 \
 -fill white \
 -draw "text 0,0 'CLICK ME'" \
  out2.png

Works for me on ImageMagick version 6.7.8-3 2012-07-19 on Mac:

<code>-kerning -0.5</code> <code>-kerning 1.5</code>

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
  • Och, I believe I was looking for this one! I will let you know after weekend when I will check! – bluszcz Jul 27 '12 at 21:10
1

I think it is -stretch and takes an enumerated parameter instead of number.

Check this link: http://www.imagemagick.org/script/command-line-options.php#stretch

Snow Blind
  • 1,164
  • 7
  • 12
  • Yes, seems like this one - but I just checked -stretch with different parameters and it does not change anything :( – bluszcz Jul 27 '12 at 12:24
  • @bluszcz Can you send me your full new command with `-stretch`? – Snow Blind Jul 27 '12 at 12:32
  • convert -gravity center button_subscribeme.png -font /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf -fill white -draw "text 0,0 'CLICK ME'" -stretch UltraExpanded render/mailbox-submit.png – bluszcz Jul 27 '12 at 12:38