@Test public void rorateImageTest(){ BufferedImage img = new BufferedImage(256, 128, BufferedImage.TYPE_INT_ARGB); BufferedImage newimg = ImageHelper.rorateImage(img, 90); assertEquals(128, newimg.getWidth()); assertEquals(256, newimg.getHeight()); }
public static BufferedImage rorateImage(BufferedImage image, int angle){ AffineTransform tx = new AffineTransform(); int x = image.getWidth() / 2; int y = image.getHeight() / 2; tx.translate(y, x); tx.rotate(Math.toRadians(angle)); tx.translate(-x, -y); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); image = op.filter(image, null); return image; }
ImageHelper { public static BufferedImage rorateImage(BufferedImage image, int angle){ AffineTransform tx = new AffineTransform(); int x = image.getWidth() / 2; int y = image.getHeight() / 2; tx.translate(y, x); tx.rotate(Math.toRadians(angle)); tx.translate(-x, -y); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); image = op.filter(image, null); return image; } }
ImageHelper { public static BufferedImage rorateImage(BufferedImage image, int angle){ AffineTransform tx = new AffineTransform(); int x = image.getWidth() / 2; int y = image.getHeight() / 2; tx.translate(y, x); tx.rotate(Math.toRadians(angle)); tx.translate(-x, -y); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); image = op.filter(image, null); return image; }  }
ImageHelper { public static BufferedImage rorateImage(BufferedImage image, int angle){ AffineTransform tx = new AffineTransform(); int x = image.getWidth() / 2; int y = image.getHeight() / 2; tx.translate(y, x); tx.rotate(Math.toRadians(angle)); tx.translate(-x, -y); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); image = op.filter(image, null); return image; }  static void convertImage(RawImage rawImage, BufferedImage image); static BufferedImage resize(BufferedImage image, int targetWidth, int targetHeight); static BufferedImage getImageFromByte(byte[] array); static String getImageType(byte[] array); static BufferedImage convertRenderedImage(RenderedImage img); static BufferedImage rorateImage(BufferedImage image, int angle); static BufferedImage rotate90DegreeRight(BufferedImage img); static BufferedImage createImage(int width, int height); static String extractFullNameFromRRInfo(HttpRequestResponseInfo hrri); static boolean isImageDecoderStatus(); static void setImageDecoderStatus(boolean imageDecoderStatus); }
ImageHelper { public static BufferedImage rorateImage(BufferedImage image, int angle){ AffineTransform tx = new AffineTransform(); int x = image.getWidth() / 2; int y = image.getHeight() / 2; tx.translate(y, x); tx.rotate(Math.toRadians(angle)); tx.translate(-x, -y); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); image = op.filter(image, null); return image; }  static void convertImage(RawImage rawImage, BufferedImage image); static BufferedImage resize(BufferedImage image, int targetWidth, int targetHeight); static BufferedImage getImageFromByte(byte[] array); static String getImageType(byte[] array); static BufferedImage convertRenderedImage(RenderedImage img); static BufferedImage rorateImage(BufferedImage image, int angle); static BufferedImage rotate90DegreeRight(BufferedImage img); static BufferedImage createImage(int width, int height); static String extractFullNameFromRRInfo(HttpRequestResponseInfo hrri); static boolean isImageDecoderStatus(); static void setImageDecoderStatus(boolean imageDecoderStatus); static boolean imageDecoderStatus; }