Label with stroke vs draw text with stroke

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rotem
Posts: 46
Joined: 2016-04-15T13:34:32-07:00
Authentication code: 1151

Label with stroke vs draw text with stroke

Post by rotem »

Hey,

I'm trying to achieve the same visual output for label as the one I get with draw text.

Here is the command for the label

Code: Select all

convert -background none -font ./assets/impact.ttf -pointsize 72 -fill white -stroke black -strokewidth 8 label:R -trim label.png
Here is the output for label

Image

----------

Here is the command for the draw text

Code: Select all

convert -background none -size 150x150 canvas:none -font ./assets/impact.ttf -pointsize 72 -fill black -stroke black -strokewidth 12 -gravity Center -draw "text 0,0 'R'" -font ./assets/impact.ttf -pointsize 68 -fill white -stroke none -gravity Center -draw "text 0,0 'R'" -trim draw.png
Here is the output for draw text

Image

The main reason that I want it is because I need to create a canvas with custom size for each char and the stroke not always aligned right with the draw text approach.

Thank you
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Label with stroke vs draw text with stroke

Post by snibgo »

With "-draw text" you write twice: first with a black stroke, then with no stroke but a white fill. You can do that with "label:"

Code: Select all

convert -background none -pointsize 72 -stroke Black -strokewidth 12 label:R -stroke None -fill White label:R -layers merge x.png
snibgo's IM pages: im.snibgo.com
rotem
Posts: 46
Joined: 2016-04-15T13:34:32-07:00
Authentication code: 1151

Re: Label with stroke vs draw text with stroke

Post by rotem »

Great, thank you
Post Reply