Page 1 of 1

Problem drawing Circles

Posted: 2015-07-07T08:27:12-07:00
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 .

Re: Problem drawing Circles

Posted: 2015-07-07T08:59:02-07:00
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.

Re: Problem drawing Circles

Posted: 2015-07-07T09:05:59-07:00
by rocastro
I understand. Whell that's ok, then no problem.

Thank's