BufferedImage (BufferedImage src, BufferedImage dest) { AffineTransform tx = AffineTransform.getScaleInstance(flipH ? -1 : 1, flipV ? -1 : 1); tx.translate(flipH ? -src.getWidth(null) : 0, flipV ? -src.getHeight(null) : 0); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); return op.filter(src, dest); }