Problem drawing Circles

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
rocastro
Posts: 10
Joined: 2015-07-07T08:21:36-07:00
Authentication code: 1151

Problem drawing Circles

Post by rocastro »

I tried to draw a circle whith the docummentation.

Draw a circle center at 500,500 whith 250 pixel radio. According to the documentation this would be the Right Way:

convert -size 1000x1000 xc:white -fill blue -draw "circle 500,500,750,750" draw_circle.png

If you look at the image you will see that is not correct, the circle that has drawn more than 250 radio pixel.

The value to be set in X2 and Y2 is the center plus the radius match the square root of 2. That is, the center plus multiply the radius by 0.7010681237. In this case the values ​​of X2 and Y2 are :

X2=Y2=500+0.7010681237*250=676.7 that's aprox. 677 pixel

convert -size 1000x1000 xc:white -fill blue -draw "circle 500,500,677,677" draw_circle_ok.png

If you look at the resulting image you will see that the circle has a radius of 250 pixel and in this case is correct.

Thanks , imagemagick is a very good program .
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem drawing Circles

Post by snibgo »

The documentation http://www.imagemagick.org/script/comma ... s.php#draw says:
The circle primitive makes a disk (filled) or circle (unfilled). Give the center and any point on the perimeter (boundary).
You need the centre eg 500,500 and one point on the circle eg 750,500.
snibgo's IM pages: im.snibgo.com
rocastro
Posts: 10
Joined: 2015-07-07T08:21:36-07:00
Authentication code: 1151

Re: Problem drawing Circles

Post by rocastro »

I understand. Whell that's ok, then no problem.

Thank's
Post Reply