http://www.imagemagick.org/discourse-se ... hp?t=14379
I have the exact same problem with both paths and rectangles. Here is the sample code that I used to trace this back:
Code: Select all
<?php
$image = new Imagick();
$image->newImage(10, 10, '#ffffff');
$image->setImageFormat('png');
$draw = new ImagickDraw();
$draw->setFillColor('red');
$draw->pathStart();
$draw->pathMoveToAbsolute(4, 4);
$draw->pathLineToAbsolute(5, 4);
$draw->pathLineToAbsolute(5, 5);
$draw->pathLineToAbsolute(4, 5);
$draw->pathClose();
$draw->pathFinish();
$draw->rectangle(4, 7, 5, 8);
$draw->point(4, 1);
$image->drawImage($draw);
As some people in the previous thread explained, this is because apparently ImageMagick does not work with the upper left pixel corners (as SVG and other vector formats do), but instead with full pixels. On the other hand, people in that thread also say that ImageMagick should work exactly like SVG, so this would definitely be a bug then.
Sidenote: according to the current behaviour, to draw a 1x1 rectangle, you'd have to do the following, but the actual result is no output at all:
Code: Select all
$draw->rectangle(4, 7, 4, 7);