possible bugs with subsection and cropping IM 6.4.2-4

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

possible bugs with subsection and cropping IM 6.4.2-4

Post by fmw42 »

IM 6.4.2-4 Q16 Mac OSX Tiger

I ran into these issues when trying to extract the last row and column from an image, BUT using the wrong offset that was one pixel outside the bounds of the image. I expected an error message and no image to be generated. I do not know if these are what you would expect or want to have happen, but I thought I would pass this on.

identify rose:
rose:=>ROSE ROSE 70x46 70x46+0+0 8-bit DirectClass 9.45kb

Try to get bottom row, but actually +46 is one row past the bottom
convert rose:[70x1+0+46] rose_bottom.png
convert: No IDATs written into file `rose_bottom.png' @ png.c/PNGErrorHandler/1412.

The above produces an image that cannot be opened

Try to get right column, but actually +70 is one column past the right side
convert rose:[1x46+70+0] rose_right.png

The above does not give an error and produces and image identical to the original

Thus I am getting somewhat inconsistent kinds of error/results
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bugs with subsection and cropping IM 6.4.2-4

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.5.2-5 Beta to fix the problem. Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bugs with subsection and cropping IM 6.4.2-4

Post by anthony »

NOTE you probably should have quotes around the square brackets, to protect them from some shells. However I verified that the problem happens.

What should have happens is you get an crop error, and a single pixel 'NULL:' missed image should be generated.

However even the normal crop for some reason fails with the wrong error...

Code: Select all

   convert rose:  -crop 70x1+0+46 rose_bottom.png
convert: No IDATs written into file `rose_bottom.png' @ png.c/PNGErrorHandler/1412.
Looks like a fatal error in the PNG coder module.

If I take out the PNG save,

Code: Select all

        convert rose:  -crop 70x1+0+47 null:
I get no error or even a warning!!!! That is also bug in IM looks like a bounray condition failure as changing 46 to 47 produces the correct error...

Code: Select all

convert rose:  -crop 70x1+0+47 null:
convert: geometry does not contain image `ROSE' @ transform.c/CropImage/507.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply