我试图旋转图像.我使用这个
Java代码:
BufferedImage oldImage = ImageIO.read(new FileInputStream("C:\\workspace\\test\\src\\10.JPG")); BufferedImage newImage = new BufferedImage(oldImage.getHeight(),oldImage.getWidth(),oldImage.getType()); Graphics2D graphics = (Graphics2D) newImage.getGraphics(); graphics.rotate(Math.toRadians(90),newImage.getWidth() / 2,newImage.getHeight() / 2); graphics.drawImage(oldImage,oldImage.getHeight(),null); ImageIO.write(newImage,"JPG",new FileOutputStream("C:\\workspace\\test\\src\\10_.JPG"));
但我看到奇怪的结果:
资源:
结果:
**Result image:** http://s14.postimage.org/cjut935ip/image.jpg
你能帮我解决这个问题吗?