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.
ImageMagick: geometry does not contain image
Re: ImageMagick: geometry does not contain image
What else i might try here with the same error while trying to Crop image ? setting page 0x0+0+0 does not help 

- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: ImageMagick: geometry does not contain image
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 imagextonic wrote:What else i might try here with the same error while trying to Crop image ? setting page 0x0+0+0 does not help
Sorry I don't know any APIs, just command line.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: ImageMagick: geometry does not contain image
fmw42 wrote: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 imagextonic wrote:What else i might try here with the same error while trying to Crop image ? setting page 0x0+0+0 does not help
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/