Imagemagick font_stretch or letter spacing?

I create several buttons using ImageMagick. However, I cannot set the distance between the letters in the generated image. The command 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 think font_strech is not a suitable option. How can i achieve this? The generated text is too narrow.

+4
source share
2 answers

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 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 command line -kerning . It takes both positive and 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>

+5
source

I think it is- -stretch and takes a numeric parameter instead of a number.

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

+1
source

All Articles