Page 1 of 2

any simpler command draw text with outer color like this?

Posted: 2012-08-10T02:25:11-07:00
by kissson
convert -size 500x500 xc:red -pointsize 100 -font "Vademecum.ttf" ^
-fill turquoise1 -stroke none -draw "gravity center text -2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 0 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 0 'test'" ^
-fill red -stroke none -draw "gravity center text 0,0 'test'" ^
out.jpg

thx

Re: any simpler command draw text with outer color like this

Posted: 2012-08-10T10:00:53-07:00
by fmw42
Perhaps you can provide links to your input and output images and also tell us what version of IM you are using.

Re: any simpler command draw text with outer color like this

Posted: 2012-08-10T18:22:33-07:00
by kissson
>convert -size 500x500 xc:red -pointsize 100 -font "Vademecum.ttf" ^
-fill turquoise1 -stroke none -draw "gravity center text -2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 0 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 0 'test'" ^
-fill red -stroke none -draw "gravity center text 0,0 'test'" ^
out.jpg
https://docs.google.com/open?id=0Bz3bfd ... U9qYWFwemc

-stroke not help
>convert -size 500x500 xc:red -pointsize 100 -font "Vademecum.ttf" ^
-fill red -stroke turquoise1 -strokewidth 2 -draw "gravity center text 0,0 'test'" ^
out.jpg
https://docs.google.com/open?id=0Bz3bfd ... Wp1amdyUFE

this also not help
convert -size 500x500 xc:red -pointsize 100 -font "Vademecum.ttf" ^
-fill red -stroke turquoise1 -strokewidth 2 -draw "gravity center text 0,0 'test'" ^
-fill red -stroke none -draw "gravity center text 0,0 'test'" ^
out.jpg
https://docs.google.com/open?id=0Bz3bfd ... 3E3TGdGMVk

Re: any simpler command draw text with outer color like this

Posted: 2012-08-10T21:11:32-07:00
by fmw42
Is this what you want?

I create an image of the text in white on black. Then colorize the white with turquoise. Then make the background transparent. The composite it over the red image in the center.


convert -respect-parenthesis \( -size 500x500 xc:red \) \
\( -background black -fill white -pointsize 100 -font /Library/Fonts/vademecu.ttf label:"test" \
-edge 2 -transparent white -background turquoise1 -flatten -transparent black \) \
-gravity center -compose over -composite result.jpg


The above is unix. Remove the \ before the parens and change the line ending \ to ^ for windows.

You can find docs for each command at http://www.imagemagick.org/script/comma ... ptions.php and examples and explanations for their use at http://www.imagemagick.org/Usage/ and http://www.imagemagick.org/Usage/reference.html

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T17:24:47-07:00
by fmw42
Actually this may be easier to understand.


# create white on black text image and make it an edge outline
# create turquoise image the same size
# create red image the same size
# reverse their order
# composite the turquoise onto the red image using the text image as a mask
# extend the red background to your desired size

convert \
\( -background black -fill white -pointsize 100 -font /Library/Fonts/vademecu.ttf label:"test" -edge 2 \) \
\( -clone 0 -fill turquoise -colorize 100% \) \
\( -clone 1 -fill red -colorize 100% \) \
-reverse -compose over -composite -gravity center -background red -extent 500x500 \
result.jpg

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:30:21-07:00
by kissson
I will stick to my vvvery long command
https://docs.google.com/file/d/0Bz3bfdI ... Fwemc/edit

because the shortened one,
https://docs.google.com/file/d/0Bz3bfdI ... RYVGs/edit

(do windows and linux produce the same output ?)

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:33:02-07:00
by fmw42
kissson wrote:I will stick to my vvvery long command
https://docs.google.com/file/d/0Bz3bfdI ... Fwemc/edit

because the shortened one,
https://docs.google.com/file/d/0Bz3bfdI ... RYVGs/edit

(do windows and linux produce the same output ?)

Window syntax is different from unix. In windows, remove the \ from parenthesis and end the lines with ^ rather than \. Also you need to escape the % with %%. See http://www.imagemagick.org/Usage/windows/

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:34:42-07:00
by fmw42
try this, but change the path to the font to your path and not mine

convert ^
( -background black -fill white -pointsize 100 -font /Library/Fonts/vademecu.ttf label:"test" -edge 2 ) ^
( -clone 0 -fill turquoise -colorize 100% ) ^
( -clone 1 -fill red -colorize 100%% ) ^
-reverse -compose over -composite -gravity center -background red -extent 500x500 \
result.jpg

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:40:51-07:00
by kissson
I am on windows, I have the font with the same path to convert.exe
please view the link above and you know the image each command produce
thanks

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:44:14-07:00
by fmw42
kissson wrote:I am on windows, I have the font with the same path to convert.exe
please view the link above and you know the image each command produce
thanks
I identified that above in my earlier post. but it is

# create white on black text image and make it an edge outline
# create turquoise image the same size
# create red image the same size
# reverse their order
# composite the turquoise onto the red image using the text image as a mask
# extend the red background to your desired size


convert ^
( -background black -fill white -pointsize 100 -font vademecum.ttf label:"test" -edge 2 ) ^ <--- text image
( -clone 0 -fill turquoise -colorize 100% ) ^ <--- turquoise image
( -clone 1 -fill red -colorize 100%% ) ^ <--- red image
-reverse -compose over -composite -gravity center -background red -extent 500x500 \
result.jpg


Note that my font was named Vademecu.ttf not Vademecum.ttf So change yours as here.

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:52:03-07:00
by kissson
VADEMECU.TTF from http://www.fontonic.com/download.asp?id=6421

(cd into IMv6.7.8-8)
convert ^
( -background black -fill white -pointsize 100 -font vademecu.ttf label:"test" -edge 2 ) ^
( -clone 0 -fill turquoise -colorize 100% ) ^
( -clone 1 -fill red -colorize 100%% ) ^
-reverse -compose over -composite -gravity center -background red -extent 500x500 ^
result.jpg
https://docs.google.com/file/d/0Bz3bfdI ... FWQXc/edit

convert ^
( -background black -fill white -pointsize 100 -font vademecu.ttf label:"test" -edge 2 ) ^
( -clone 0 -fill turquoise -colorize 100%% ) ^
( -clone 1 -fill red -colorize 100%% ) ^
-reverse -compose over -composite -gravity center -background red -extent 500x500 ^
result.jpg
https://docs.google.com/file/d/0Bz3bfdI ... pPblU/edit

convert -size 500x500 xc:red -pointsize 100 -font "Vademecum.ttf" ^
-fill turquoise1 -stroke none -draw "gravity center text -2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 0 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 0 'test'" ^
-fill red -stroke none -draw "gravity center text 0,0 'test'" ^
out.jpg
https://docs.google.com/file/d/0Bz3bfdI ... Fwemc/edit

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T19:57:16-07:00
by fmw42
Reverse the black and white when creating the text to this in the windows command


convert \
\( -background white -fill black -pointsize 100 -font /Library/Fonts/vademecu.ttf label:"test" -edge 2 \) \
\( -clone 0 -fill turquoise -colorize 100% \) \
\( -clone 1 -fill red -colorize 100% \) \
-reverse -compose over -composite -gravity center -background red -extent 500x500 \
result.jpg

Also your first post does say vademecum.ttf

Re: any simpler command draw text with outer color like this

Posted: 2012-08-12T20:02:50-07:00
by kissson
oh thanks, it is almost the same as I want

Re: any simpler command draw text with outer color like this

Posted: 2012-08-22T21:51:58-07:00
by anthony
Looks like you are trying to add an outline to some text.. much like the compound font example
http://www.imagemagick.org/Usage/fonts/#outline

Other examples follow the above link that are often easier. Specifically using stroke to outline the font.

Re: any simpler command draw text with outer color like this

Posted: 2012-08-23T00:03:30-07:00
by kissson
woo, thx.
I wont use stroke, because it is ugly on Vademecum, and no outline effect. (in line)
and how can I control the text to be center of the image ? seems annotate is starting by the lower left corner
I am now first calculate the total width and height of the text, then /2, and minus the width and plus the height of center to annotate

>convert -size 500x500 xc:red -pointsize 100 -font Vademecum.ttf -pointsize 100 ^
-fill turquoise1 -annotate +248+248 test ^
-annotate +248+252 test ^
-annotate +252+252 test ^
-annotate +252+248 test ^
-annotate +248+250 test ^
-annotate +250+252 test ^
-fill red -annotate +250+250 test ^
out.jpg
https://docs.google.com/open?id=0Bz3bfd ... XhrMGRFbG8

>convert -size 500x500 xc:red -pointsize 100 -font "Vademecum.ttf" ^
-fill turquoise1 -stroke none -draw "gravity center text -2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0,-2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text -2, 0 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 0, 2 'test'" ^
-fill turquoise1 -stroke none -draw "gravity center text 2, 0 'test'" ^
-fill red -stroke none -draw "gravity center text 0,0 'test'" ^
out.jpg
https://docs.google.com/open?id=0Bz3bfd ... U9qYWFwemc