Here you can find the source of rotateImage(BufferedImage image, double angle)
public static BufferedImage rotateImage(BufferedImage image, double angle)
//package com.java2s; //License from project: Apache License import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; public class Main { public static BufferedImage rotateImage(BufferedImage image, double angle) { int width = image.getWidth(); int height = image.getHeight(); BufferedImage destinationImage = new BufferedImage(width, height, image.getType()); Graphics2D graphics = destinationImage.createGraphics(); graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.rotate(Math.toRadians(angle), width / 2, height / 2); graphics.drawImage(image, null, 0, 0); graphics.dispose();/*from ww w. j a v a 2 s. c o m*/ return destinationImage; } }