Here you can find the source of rotate(BufferedImage img, int b, int a, int angle)
public static Image rotate(BufferedImage img, int b, int a, int angle)
//package com.java2s; //License from project: Open Source License import java.awt.*; import java.awt.image.*; public class Main { public static Image rotate(BufferedImage img, int b, int a, int angle) { int w = img.getWidth(); int h = img.getHeight(); BufferedImage dimg = new BufferedImage(w, h, img.getType()); Graphics2D g = dimg.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); g.rotate(Math.toRadians(angle), w / 2, h / 2); g.drawImage(img, null, 0, 0);/*w ww .j a va2s. c o m*/ return dimg; } }