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.

The right and bottom sides of a rectangle seem to be 1 pixel too large for me, in every case. A 2x2 rectangle renders 3x3.
Version: ImageMagick 6.5.2-9 2009-06-16 Q16
OS X leopard

I'm using PHP Imagick 2.3.0. Haven't tested with command line.

8,8 to 12,12 is a 5 pixel range as you have to count the starting pixel and go to the ending pixel. thus 12-8+1=5. Remember you have to include the start pixel as it is inclusive --- you start to draw on the first pixel and end the draw on the last pixel; so 8,9,10,11,12 that is 5 pixels

But images don't follow the same rule. I have to subtract 1 from the right and bottom sides to make them fit together. A 100,100 image is the same size as a 99x99 rectangle. They match in every other graphics library I've used. Are you sure this isn't a bug? =)

emery wrote:But images don't follow the same rule. I have to subtract 1 from the right and bottom sides to make them fit together. A 100,100 image is the same size as a 99x99 rectangle. They match in every other graphics library I've used. Are you sure this isn't a bug? =)

That is because the index starts at zero. Thus an image that goes from 0 to 99 is 100 pixels wide. The same kind of arithmetic as in drawing a box. The width of a subsection is xmax-xmin+1. With image dimensions xmax=99 xmin=0 thus 99-0+1=100

fmw42 wrote:[That is because the index starts at zero. Thus an image that goes from 0 to 99 is 100 pixels wide. The same kind of arithmetic as in drawing a box. The width of a subsection is xmax-xmin+1. With image dimensions xmax=99 xmin=0 thus 99-0+1=100

Taking that further. If you draw a rectangle on a 100x100 image you would draw it from the top-left pixel 0,0 to the bottom right pixel 99,99 That is $rect->rectangle(0,0,99,99);

Rectangles are inclusive, Pixel positions are not.