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.
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
-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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With