Page 1 of 1

-draw produces a pimple on circles and arcs

Posted: 2012-11-30T21:58:49-07:00
by rmabry
The following command draws a circle. But the circle has a zit.

Code: Select all

convert -size 200x200 xc:white -fill black -draw "circle 100,100 180,100" PNG32:badcircle.png
Zoom in on the rightmost pixels and you'll see this:

Image

A fix? In the file draw.c, in the function TraceEllipse() are the following lines, the fifth of which can be changed to get rid of the zit, by dropping the subtraction of MagickEpsilon.

Code: Select all

angle.x=DegreesToRadians(degrees.x); 
  y=degrees.y;
  while (y < degrees.x)
    y+=360.0;
  angle.y=(double) (DegreesToRadians(y)-MagickEpsilon);
  
The asymmetry between the x and y variables made it suspicious. But I don't know what else the change breaks, and I'm sure the subtraction is there for a good reason.

The following is an amusing workaround. The blue figures are made using an angle range of -180 to 180 instead of 0 to 360, and those figures seem unblemished.

Code: Select all

convert -size 400x400 xc:white -fill black -draw "circle 200,100 250,100 arc 50,250 150,150 0,360 ellipse 100,320 80,40 0,360" -fill blue -draw "arc 250 ,250 350,150 -180,1 80 ellipse 300,320 80,40 -180,180 " PNG32:badcircles.png
This is 6.8.0-5 2012-11-03 Q16 on Windows 7.

Rick

Re: -draw produces a pimple on circles and arcs

Posted: 2012-12-01T06:04:59-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.0-8 Beta available by sometime tomorrow. Thanks.