vertical flip BufferedImage - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage Rotate

Description

vertical flip BufferedImage

Demo Code


//package com.java2s;

import java.awt.image.*;
import java.awt.*;

public class Main {
    public static BufferedImage verticalflip(BufferedImage img) {
        int w = img.getWidth();
        int h = img.getHeight();
        BufferedImage dimg = new BufferedImage(w, h, img.getColorModel()
                .getTransparency());//www  .jav  a2s .c  o  m
        Graphics2D g = dimg.createGraphics();
        g.drawImage(img, 0, 0, w, h, 0, h, w, 0, null);
        g.dispose();
        return dimg;
    }
}

Related Tutorials