Siehe auch: Imagemagick, Befehlsbeispiele mit convert (Tricks)
Quelle 1)
Creating a font image using a „label:“ image, is the more typical way of drawing a font quickly in ImageMagick. The biggest advantage is that generates its own canvas according the current „-background“ and „-fill“ color settings, which is sized to match the drawn text.
For example here is a typical generated label.
convert -background lightblue -fill blue \
-font Candice -pointsize 72 label:'Das ist der laaange Text' \
label.gif
The biggest trick to using labels to generate images of a specific „-size“ is NOT to specify a „-pointsize“ for the label. When this happens IM will have the freedom to try and select a font size that best fits the image size requested. That is the drawn text will be adjusted to fit the given size!
convert -background lightblue -fill blue -font Candice -size 400x100 label:'Noch ein toller Text' label_size_fit.gif
The „label:“ generator can (as of IM version 6.2.5) generate multi-line labels.
convert -background lightblue -fill blue -font Ravie -pointsize 20 \ label:'ImageMagick\nRules - OK!' label_multiline.gif
Für komplizierter Formatierungen innerhalb des Textes kann man Pango verwenden (HTML-ähnliche Skriptsprache) oder SVG.
convert -background lightblue pango:' Some <span size="49152" rise="-20480" foreground="red" background="blue"> Big Red <b>on</b> Blue </span> Text ' pango_span.gif
IM >= v6.5.5-8
20 Pixel mehr als normal:
convert -interline-spacing 20 label:'First\nSecond' label_lspace_20.gif