Page 1 of 1

trying to write a colored number inside a circle

Posted: 2019-04-21T01:02:40-07:00
by manit
Hi,
I am using imagemagick on 64bit ubuntu OS

$ convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

I am trying to write a number inside a circle.
I have tried following
$convert -size 388x374 xc:white sth.png
$convert sth.png -fill none -strokewidth 2 -stroke red -draw 'circle 108,283 108,293' sth-with-circle.png
$ convert sth-with-circle.png -fill none -strokewidth 2 -stroke black -draw 'rectangle 98,273 118,293' sth-with-circle-and-rect.png
$ convert sth-with-circle-and-rect.png \( -size 20x20 -background none label:"12" -trim -gravity center -extent 20x20 \) -gravity northwest -geometry +98+273 -composite sth-with-circle-rectangle-number.png
My problem is that 12 is written in black .
I tried -fill green , -stroke green next to label option .
Thanks.

Re: trying to write a colored number inside a circle

Posted: 2019-04-21T01:05:53-07:00
by manit
I tried

-stroke blue -strokewidth 1 before label then it worked.

This thread is solved.

Re: trying to write a colored number inside a circle

Posted: 2019-04-21T13:04:09-07:00
by fmw42
No need for 4 commands.

Code: Select all

convert -size 388x374 xc:white \
-fill none -strokewidth 2 -stroke red -draw 'circle 108,283 108,293' \
-fill none -strokewidth 2 -stroke black -draw 'rectangle 98,273 118,293' \
\( -size 20x20 -background none -stroke blue -strokewidth 1 label:"12" -trim +repage -gravity center -extent 20x20 \) \
-gravity northwest -geometry +98+273 -composite sth-with-circle-rectangle-number.png