-draw produces a pimple on circles and arcs

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
User avatar
rmabry
Posts: 148
Joined: 2004-04-13T11:25:27-07:00

-draw produces a pimple on circles and arcs

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -draw produces a pimple on circles and arcs

Post 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.
Post Reply