bluszcz
bluszcz

Reputation: 4128

Imagemagick font_stretch or spacing between letters?

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.

Upvotes: 4

Views: 4587

Answers (2)

Kurt Pfeifle
Kurt Pfeifle

Reputation: 90203

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>

Upvotes: 8

Snow Blind
Snow Blind

Reputation: 1164

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

Upvotes: 1

Related Questions