Jay
Jay

Reputation: 1265

How to solve error java.lang.IllegalArgumentException: Unknown image type 0?

I'm making application in java swing with netbeans platform. In my app I rotate MyImage.tiff (16 bit, tiff, Gray-Scale Image) it rotate image but change the type of MyImage.tiff. Before rotate image myImage.tiff type is 11, but after rotate MyImage.tiff it type change and it becomes 0 type of BufferedImage. So how to solve this Problem. In my app I use JAI for rotate image.I not installed JAI in my PC, but I made wrapper module in which I used jar files of JAI. So are there any missing jar files? My code for rotate Image is below.

public BufferedImage rotateRighteImage(BufferedImage im) {
    int value = 90;
    float angle = (float) (value * (Math.PI / 180.0F));
    ParameterBlock pb = new ParameterBlock();
    pb.addSource(im); // The source image
    pb.add(0.0F); // The x origin
    pb.add(0.0F); // The y origin
    pb.add(angle); // The rotation angle
    // Create the rotate operation
    RenderedOp create = JAI.create("Rotate", pb, null);
    im = create.getAsBufferedImage();
    return im;
}

Upvotes: 3

Views: 1400

Answers (0)

Related Questions