Java BufferedImage Rotate rotate(BufferedImage img, int angle)

Here you can find the source of rotate(BufferedImage img, int angle)

Description

rotate

License

Open Source License

Declaration

private static BufferedImage rotate(BufferedImage img, int angle) 

Method Source Code


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

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

public class Main {
    private static BufferedImage rotate(BufferedImage img, int angle) {
        int w = img.getWidth();
        int h = img.getHeight();
        BufferedImage dimg = new BufferedImage(w, h, img.getType());
        Graphics2D g = dimg.createGraphics();
        g.rotate(Math.toRadians(angle), w / 2., h / 2.);
        g.drawImage(img, null, 0, 0);//w  ww .  j  a  va  2 s.  c  o  m
        return dimg;
    }
}

Related

  1. rotate(BufferedImage bi, int degree)
  2. rotate(BufferedImage image, double theta)
  3. rotate(BufferedImage image, double theta, int anchorX, int anchorY)
  4. rotate(BufferedImage image, float theRadiansAngle)
  5. rotate(BufferedImage image, int degrees)
  6. rotate(BufferedImage img, int angle)
  7. rotate(BufferedImage img, int angle)
  8. rotate(BufferedImage img, int angle)
  9. rotate(BufferedImage img, int b, int a, int angle)