ImageCrop: The rectangular crop area must not be outside the image

Today I was resizing and cropping some images with ColdFusion when I ran into the following issue. After resizing the image using ImageScaleToFit(), ImageCrop() would throw an error stating that "The rectangular crop area must not be outside the image." I was able to confirm that the crop area was not outside of the image, so I was a little perplexed. Then I found the following listed as a known JAI bug:

Using interpolation types other than nearest neighbor may cause the "Crop" operation to fail in renderable mode with an IllegalArgumentException with the message "The rectangular crop area must not be outside the image".

Given this I changed ImageScaleToFit() to use "nearest" for the interpolation argument and the error went away. Anyway, I'm blogging this in case anyone else runs into a similar issue.

Comments
Col.'s Gravatar Thanks, helped me out.
Greetings from munich
# Posted By Col. | 3/2/12 5:57 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.