Java Image Rotate imageRotate(Image img, int angle)

Here you can find the source of imageRotate(Image img, int angle)

Description

image Rotate

License

Open Source License

Declaration

public static BufferedImage imageRotate(Image img, int angle) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage imageRotate(Image img, int angle) {
        BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
        Graphics2D graphics = (Graphics2D) bi.getGraphics();
        graphics.rotate(Math.toRadians(angle), 26, 26);
        graphics.drawImage(img, 0, 0, null);
        graphics.dispose();/* w  w w .j  a  v  a  2  s.  c o m*/
        return bi;
    }
}

Related

  1. rotate(File sourceImage, String targetImageName, double degree)
  2. rotate(Image image, double angle)
  3. rotate(Image img, double angle)
  4. rotate(Image img, double angle)