crop operation not working in JAI 1.1.3?
The "crop" operation seems to be broken in JAI 1.1.3 (at least for Windows):
When cropping an image, the values for x and y are ignored and the new image is always the part from the upper left corner of the original image.
In JAI 1.1.2 this worked correctly.
Code to reproduce the problem (call program with old and new filename as parameters):
The program should cut out an image with half the height and width from the middle of the original image.
public static void main(String[] args) {
// load image
ParameterBlock loadPB = new ParameterBlock();
loadPB.add(args[0]);
RenderedOp image = JAI.create("fileload", loadPB);
// crop image
int width = image.getWidth();
int height = image.getHeight();
int newWidth = width / 2;
int newHeight = height / 2;
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
pb.add((float)(width - newWidth)/2);
pb.add((float)(height - newHeight)/2);
pb.add((float)newWidth);
pb.add((float)newHeight);
RenderedOp cropped = JAI.create("crop", pb, null);
// save image
ParameterBlock savePB = new ParameterBlock();
savePB.addSource(cropped);
savePB.add(args[1]);
savePB.add("jpeg");
JAI.create("filestore", savePB);
}

