Java examples for 2D Graphics:BufferedImage Rotate
flip BufferedImage
//package com.java2s; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; public class Main { public static BufferedImage flip(BufferedImage bi, boolean x, boolean y) { AffineTransform tx = AffineTransform.getScaleInstance(x ? -1 : 1, y ? -1 : 1);//from www .j a va 2s . c o m if (x || y) { tx.translate(x ? -bi.getWidth() : 0, y ? -bi.getHeight() : 0); } AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); return op.filter(bi, null); } }