Can Image magic create an outline around 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
questorfla
Posts: 3
Joined: 2016-02-12T19:25:16-07:00
Authentication code: 1151

Can Image magic create an outline around text?

Post by questorfla »

If so, is there a command-line method of doing this?
I have searched everywhere for a true TTF font with more than one color but so far, no luck.
I use ImageMagick command line tools already in a batch to do things that normally took multiple open, edit, close functions
and would be delighted to find a way to handle this.
For instance, taking a line of text, adding a red or blue Halo effect, then converting to png.
Or even convert to png as black on white background then add the halo.
the end product has to be a png file anyway

Thanks for any suggestions There are so many ways to do things in ImageMagick that sometimes I think it really is Magick!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can Image magic create an outline around text?

Post by snibgo »

snibgo's IM pages: im.snibgo.com
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Can Image magic create an outline around text?

Post by GeeMack »

questorfla wrote:For instance, taking a line of text, adding a red or blue Halo effect, then converting to png.
Or even convert to png as black on white background then add the halo.
That sort of thing is frequently done by using "-annnotate" twice, something like this (using ImageMagick 7 on Windows 7 64)...

Code: Select all

magick -size 400x100 xc:none -pointsize 36 -fill white -stroke blue -strokewidth 4 -gravity center ^
   -annotate +0+0 "Your Text Here" -blur 0x3 -stroke none -annotate +0+0 "Your Text Here" result.png
Do it without the "-blur" for an outline instead of a halo. You could "-trim" the result and add a transparent "-border" of a few pixels to get rid of the excess canvas.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can Image magic create an outline around text?

Post by fmw42 »

If on Unix (Linux, Mac OSX or Windows with Cygwin or Windows 10), see my scripts texteffect and texteffect2 at the link below.

P.S. Outline fonts do exist, but they are b/w and not two-colors
Post Reply