Here you can find the source of symmetrifyY(BufferedImage image, boolean useFirstHalfImage, boolean flipVertical)
public static BufferedImage symmetrifyY(BufferedImage image, boolean useFirstHalfImage, boolean flipVertical)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { public static BufferedImage symmetrifyY(BufferedImage image, boolean useFirstHalfImage, boolean flipVertical) { int halfWidth = image.getHeight() / 2; int startReadPosition = 0; int startWritePosition = 0; int endWritePosition = image.getHeight() - 1; if (!useFirstHalfImage) startReadPosition = halfWidth; if (!useFirstHalfImage ^ flipVertical)//xor {// ww w . j a v a2 s . c o m startWritePosition = halfWidth; endWritePosition = halfWidth; } BufferedImage returned = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); for (int i = 0; i < image.getWidth(); i++) { for (int j = 0; j < image.getHeight() / 2; j++) { int color = image.getRGB(i, startReadPosition + j); returned.setRGB(i, startWritePosition + j, color); returned.setRGB(i, endWritePosition - j, color); } } return returned; } }