Hi, i am supposed to read an image from a file , rotate it and overwrite the existing file with a rotated version, i use java2D api, the result is a blur rotated file with 3/4 black portion added to it vertically, here's the code. Would apprecite help. BufferedImage bi=this.readImage(filename); //reading and writng is fine because i do get the same file intact if i comment out the rotating code int y=bi.getHeight(); int x= bi.getWidth(); AffineTransform tx = new AffineTransform(); tx.rotate(1.57, x/2,y/2); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); bi = op.filter(bi, null); this.writeToFIle();
If your image height and width is not the same parts of the image get cut off... you'll have to copy the image into another image that is big enough to fit the rotated image and then rotate that. Here's some example code that should help.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Do not threaten THIS beaver! Not even with this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads