Page 1 of 1

6.6.0-1: drawing issues with rectangle stroke

Posted: 2010-03-25T16:05:18-07:00
by dmpatierno
Draw a simple rectangle with 10 pixel stroke:

Code: Select all

convert blank.jpg -stroke black -strokewidth 10 -fill blue -draw "rectangle 50,50 200,200" blank-out.jpg
It works correctly in 6.6.0-0:

Image

...but is broken in 6.6.0-1 and later (6.6.0-9 as of this writing):

Image

This also applies to the roundrectangle command, and produces even stranger results there.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2010-03-25T16:13:06-07:00
by fmw42
I confirm the same kind of results with

convert -size 250x250 xc:white -stroke black -strokewidth 10 -fill blue \
-draw "rectangle 50,50 200,200" tmp.png


in IM 6.6.0-9 Q16 Mac OSX Tiger

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2010-03-25T17:05:50-07:00
by snibgo
With fmw42's command, I get the same broken result in Windows 7, IM 6.6.0-8. It works fine in IM 6.5.8.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2010-03-25T17:12:41-07:00
by magick
We can reproduce the problem and will have a patch in ImageMagick 6.6.0-10 Beta within a day or two. Thanks.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-06-28T21:53:30-07:00
by grepper
This bug appears to have resurfaced. I am using:
Version: ImageMagick 6.7.7-9 2012-06-25 Q16 http://www.imagemagick.org
on Debian Sid.

Example command from the todisc script:
convert -size 96x64+5+5 xc:none +antialias -fill none -stroke '#DE7F7C'
-strokewidth 4 -draw @draw_file -resize 96x64! select.png

where draw_file contains:
rectangle 2,2 93,61

Result:
Image

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-06-29T07:00:27-07:00
by magick
The problem is a sensitivity to epsilon, the smallest difference between two points. We recently made it smaller but apparently too much. We'll have a patch available in ImageMagick 6.7.8-0 Beta by sometime tomorrow. Thanks for the report.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-06-29T13:19:45-07:00
by grepper
Great news, thanks for the quick reply and action !

cheers,
Robert

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-07-18T03:36:12-07:00
by ba!joodoo.
Dear developers,

after upgrading our server to version 6.7.8-3 we noticed that the problem still seems to exist.
(inside our system we're producing a test image to check for changes and errors)

Rectangles with a stroke width of more than 2 pixel produce still incorrect output as you can see in the following picture:
Image

To show the incorrect output, we attached these test images for all the versions of imageMagick we tried so far. Every image was produce by identical code.
You can download the archive here.

The following versions are included:
- 6.3.5-0 (okay)
- 6.4.3-0 (okay)
- 6.5.9-8 (okay)
- 6.5.9-10 (okay)
- 6.6.0-4 (horrible)
- 6.7.8-3 (better, but still incorrect)

Thanks a lot in advance for checking this "bug"(?)

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-07-18T04:08:33-07:00
by magick
Can you post a URL to the source for generating your image? We need to reproduce the problem before we can fix it. We tried this command, for example, and get correct results:
  • convert -size 110x110 xc:black -stroke white -strokewidth 3 -draw "rectangle 10,10 100,100" show:
Also, where are you running? Linux, Mac OS X, or Windows?

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-07-18T04:52:55-07:00
by ba!joodoo.
Hi,

our systenm is running on linux (ubuntu/debian).
We're producing output via PHP (PHP Version 5.3.3-7+squeeze13)
imagick module version is 3.0.0RC1

Code: Select all

        $image = newImagick();
        $drawRect = new ImagickDraw($image);
        $drawRect->setFillColor("#00FF0080");
        $drawRect->setStrokeWidth(5 * M_PI);
        $drawRect->setStrokeColor("#FFFF0080");
        $drawRect->setstrokelinejoin(IMAGICK::LINEJOIN_MITER);
        $drawRect->setStrokeLineCap(IMAGICK::LINECAP_UNDEFINED);
        $drawRect->setStrokeMiterLimit(255);
        $drawRect->rectangle(75, 125, 125, 275);
        $image->drawImage($drawRect);
HTH. If you need any other information - just let us know!

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-07-18T05:36:27-07:00
by magick
Thanks for the problem report. We have a patch to fix the problem. It will be available in the ImageMagick 6.7.8-4 release later this week.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2012-07-18T05:59:56-07:00
by ba!joodoo.
Hello,

thanks a lot!
We're looking forward to the next release ...

Drawing issues with rectangle stroke (6.8.5-5)

Posted: 2013-05-21T05:49:53-07:00
by zwak
Hi

Reply for old thread, but I think it is same issue.

I finally got latest version of IM from macports working, but I still get this kind of trouble with rectangles using
Version: ImageMagick 6.8.5-5 2013-05-21 Q16 http://www.imagemagick.org

convert UV522_RVK_25.tif.png -stroke red -fill none -draw "stroke-opacity 0.5 stroke-width 20 rectangle 1140,800 6780,10400" V512AA.pdf

Rectangle will be irregular width stroke. 20 wide shows this well. 1px wide works apparently OK, but if I do multible 1 px draws with same time it again has problems

convert UV522_RVK_25.tif.png -crop 3x1+1140+800@ -page A3 -units PixelsPerInch -density 72 -stroke red -fill none -draw "stroke-opacity 0.5 stroke-width 10 rectangle 1140,800 6780,10400" -draw "stroke-opacity 0.5 stroke-width 10 rectangle 1139,799 6781,10401" -draw "stroke-opacity 0.5 stroke-width 10 rectangle 1138,798 6782,10402" -draw "stroke-opacity 0.5 stroke-width 10 rectangle 1137,797 6783,10403" -draw "stroke-opacity 0.5 stroke-width 10 rectangle 1136,796 6784,10404" -draw "stroke-opacity 0.5 stroke-width 10 rectangle 1135,795 6785,10405" V512BB.pdf

pictures: http://lr.iki.fi/tempimages/imbug/

(files are 30MB)

Any hint for workaround would be nice.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2013-05-21T22:49:01-07:00
by anthony
can you use some other image file other than PDF, prefably PNG.

Re: 6.6.0-1: drawing issues with rectangle stroke

Posted: 2013-05-22T00:02:16-07:00
by zwak
Hi, now png original and result images are in there now, sorry, didn't think about formats.

As workaround I have now used drawing just lines.

(Data is Finnish Maanmittauslaitos rasterimaastokartta 3/2012, Licence for data: http://www.maanmittauslaitos.fi/en/NLS_ ... 1_20120501)