Stroke overlaps the text

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
DSanburn

Stroke overlaps the text

Post by DSanburn »

I've found that when I am attempting to do a stroke on text, the stroke color overlaps the fill color and makes my text look choppy and ugly. Here is the command I am using:

convert -background none -fill black -font /usr/share/fonts/TrueType/times.ttf \
+pointsize +antialias -gravity center -size 800x100 \
-stroke white -undercolor none \
caption:'ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems.' \
out.png

I would appreciate any help or suggestions you might be able to offer.
Thanks
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Stroke overlaps the text

Post by Bonzo »

This works for me; I have used a different font, added a font size and changed the stroke colour so it stands out on my page :D

Code: Select all

convert -size 800x100 -background none -fill black -stroke blue -strokewidth 1 -pointsize 20 -font verdana.ttf -gravity center caption:"ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems." out1.png
I think the problem was the +antialias
DSanburn

Re: Stroke overlaps the text

Post by DSanburn »

Yeah, the problem is I need the antialiasing off. My need is for a solid text without any of the dispersion or faded edges.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Stroke overlaps the text

Post by anthony »

The outside edge, or both edges of the stroke?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
DSanburn

Re: Stroke overlaps the text

Post by DSanburn »

I'm wanting a solid inside with just a single pixel outline. I've been able to fake it by writing the text four times with an offset of 1 pixel in each direction and then writing the text once in the center. This works and does what I want but it takes a lot longer to process than I would think this feature should.

-Doug
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Stroke overlaps the text

Post by anthony »

You can draw the image twice, once with a stroke color and strokewidth of say 2, and again without those options.

It is a bit like http://imagemagick.org/Usage/fonts/#thick_stroke but using a thiner initial stroke width.

You ware talking about anti-aliasing before, do you want a smooth anti-aliased stroke, or a aliased (two color only) stroke?

You could try using the options
+antialias -fill white -stroke black -strokewidth .5
though the line does not look very smooth due to the aliasing (staircase) effects.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply