Here you can find the source of mirror(final BufferedImage image, final boolean horizontal)
public static BufferedImage mirror(final BufferedImage image, final boolean horizontal) throws Exception
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { public static BufferedImage mirror(final BufferedImage image, final boolean horizontal) throws Exception { int width = image.getWidth(); int height = image.getHeight(); BufferedImage output = new BufferedImage(image.getHeight(), image.getWidth(), image.getType()); for (int i = 0; i < width; i++) { for (int j = 0; j < image.getHeight(); j++) { if (horizontal) { output.setRGB(width - i - 1, j, image.getRGB(i, j)); } else { output.setRGB(i, height - j - 1, image.getRGB(i, j)); }//from www. j a va 2 s . com } } return output; } }