6.6.0-1: drawing issues with rectangle stroke

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
dmpatierno

6.6.0-1: drawing issues with rectangle stroke

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 6.6.0-1: drawing issues with rectangle stroke

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: 6.6.0-1: drawing issues with rectangle stroke

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: 6.6.0-1: drawing issues with rectangle stroke

Post 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.
grepper
Posts: 7
Joined: 2010-04-14T06:37:54-07:00
Authentication code: 8675308

Re: 6.6.0-1: drawing issues with rectangle stroke

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

Re: 6.6.0-1: drawing issues with rectangle stroke

Post 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.
grepper
Posts: 7
Joined: 2010-04-14T06:37:54-07:00
Authentication code: 8675308

Re: 6.6.0-1: drawing issues with rectangle stroke

Post by grepper »

Great news, thanks for the quick reply and action !

cheers,
Robert
User avatar
ba!joodoo.
Posts: 3
Joined: 2012-07-18T02:20:26-07:00
Authentication code: 15

Re: 6.6.0-1: drawing issues with rectangle stroke

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

Re: 6.6.0-1: drawing issues with rectangle stroke

Post 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?
User avatar
ba!joodoo.
Posts: 3
Joined: 2012-07-18T02:20:26-07:00
Authentication code: 15

Re: 6.6.0-1: drawing issues with rectangle stroke

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

Re: 6.6.0-1: drawing issues with rectangle stroke

Post 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.
User avatar
ba!joodoo.
Posts: 3
Joined: 2012-07-18T02:20:26-07:00
Authentication code: 15

Re: 6.6.0-1: drawing issues with rectangle stroke

Post by ba!joodoo. »

Hello,

thanks a lot!
We're looking forward to the next release ...
zwak
Posts: 4
Joined: 2013-05-21T05:08:55-07:00
Authentication code: 6789

Drawing issues with rectangle stroke (6.8.5-5)

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: 6.6.0-1: drawing issues with rectangle stroke

Post by anthony »

can you use some other image file other than PDF, prefably PNG.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
zwak
Posts: 4
Joined: 2013-05-21T05:08:55-07:00
Authentication code: 6789

Re: 6.6.0-1: drawing issues with rectangle stroke

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