Page 1 of 1
ImageMagick: geometry does not contain image
Posted: 2007-01-16T18:38:25-07:00
by xinito
I have an image, which looks fine to me when I write it out.
I use image.crop(Geometry) to crop the image, but it gives me the exception: ImageMagick: geometry does not contain image.
The image was previously cropped without error. The error occured when I crop the cropped image.
I print out the size od the first cropped image and the geometry for the second crop, they all look reasonable to me.
Please help.
Posted: 2007-01-16T18:44:29-07:00
by magick
Cropping is relative to the virtual canvas. Try setting the page (which defines the virtual canvas) to 0x0+0+0 before you attempt a second crop.
Posted: 2007-01-17T09:13:43-07:00
by xinito
Thank you very much. May I ask which C++ API method shall I use to set the virtual canvas?
Posted: 2007-01-17T10:01:17-07:00
by xinito
use "page", i think
Re: ImageMagick: geometry does not contain image
Posted: 2010-09-29T15:29:33-07:00
by xtonic
What else i might try here with the same error while trying to Crop image ? setting page 0x0+0+0 does not help

Re: ImageMagick: geometry does not contain image
Posted: 2010-09-29T15:58:32-07:00
by fmw42
xtonic wrote:What else i might try here with the same error while trying to Crop image ? setting page 0x0+0+0 does not help

0x0 makes the result of zero size whatever, so no doubt it complains. you need to specify a WIDTHxHEIGHT+0+0 where the width and height are the size of your image
Sorry I don't know any APIs, just command line.
Re: ImageMagick: geometry does not contain image
Posted: 2010-09-29T20:07:44-07:00
by anthony
fmw42 wrote:xtonic wrote:What else i might try here with the same error while trying to Crop image ? setting page 0x0+0+0 does not help

0x0 makes the result of zero size whatever, so no doubt it complains. you need to specify a WIDTHxHEIGHT+0+0 where the width and height are the size of your image
Sorry I don't know any APIs, just command line.
Sorry Fred. A page size of 0x0 means it is unset (as it is nonsense). It means use the size of the actual image!
If after setting the page for an image your crop is still failing then the crop bounds do not actually hit the image proper! The offset and size specifing the area to crop just 'misses' the image.
See IM Examples, The Missed Image (from a bad crop)
http://www.imagemagick.org/Usage/crop/#crop_missed
This especially happens if you did not use +repage after previous crops or image trimming, before saving the result. OR you are working with GIF animations.
If you will like further help, we will need an example, and the command you are trying, so we can see what is wrong, but I can pretty well gurantee it is as we have said. your crop 'missed' the actual image proper.