0

I am using imagemagick to create some simple graphics using the Dymo font. Here is an example:

convert -background White -fill DarkRed -font Dymo -pointsize 72 label:"DYMO FONT" -trim name.png

This command creates a file that looks like this:

Dymp font Imagemagick example

I would like the red to fill all the way across, so that the image looks like a single label. I plan to use this on a page with a black background, which makes it look even worse.

I have played around with this for a while with no luck. Help would be appreciated.

Version: ImageMagick 6.9.2-7 Q16 x86_64 2015-12-06

O/S: Fedora 23

John W
  • 561
  • 1
  • 5
  • 17

1 Answers1

1

I don't know why it does that, but you can generate the text you want by replacing the space with a UTF non-breaking space and sending that to the stdin of convert and asking -label to read its text from the "file" called stdin:

printf "DYMO\xc2\xa0FONT" | 
   convert -background white -fill DarkRed -font DYMO -pointsize 72 label:@- result.png

enter image description here

Add -trim just before the output filename if you want the extraneous white space trimmed off from around the edges.

If you had more complicated text and didn't want to do that for all spaces, you could replace spaces using a short piece of Perl or sed to do it for you...

echo -n "Text with lots of spaces." | sed 's/ /\xC2\xA0/g' | convert -background white -fill DarkRed -font dymo -pointsize 72 label:@- -trim label.png

enter image description here

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432