import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
public class FlipHorizontally {
public static void main(String[] args) throws Exception {
BufferedImage image = ImageIO.read(new File("image.bmp"));
for (int i = 0; i < image.getWidth() / 2; i++) {
for (int j = 0; j < image.getHeight(); j++) {
int temp = image.getRGB(i, j);
image.setRGB(i, j, image.getRGB(image.getWidth() - i - 1, j));
image.setRGB(image.getWidth() - i - 1, j, temp);
}
}
ImageIO.write(image, "bmp", new File("image.bmp"));
}
}