Here you can find the source of rotateImage(BufferedImage image, float angle)
public static BufferedImage rotateImage(BufferedImage image, float angle)
//package com.java2s; //License from project: Open Source License import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; public class Main { /** the graphic2d changes, must use the new one for future operations. use image.createGraphics(); */ public static BufferedImage rotateImage(BufferedImage image, float angle) { AffineTransform tx = new AffineTransform(); tx.rotate(angle, image.getWidth() / 2, image.getHeight() / 2); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); return op.filter(image, null); }/*from w w w. j ava 2 s . c o m*/ }