deep Copy BufferedImage - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage

Description

deep Copy BufferedImage

Demo Code


//package com.java2s;

import java.awt.image.*;

public class Main {
    public static BufferedImage deepCopy(BufferedImage bi) {
        ColorModel cm = bi.getColorModel();
        boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
        WritableRaster raster = bi.copyData(null);
        return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
    }/* w ww. j a v  a  2 s. co m*/
}

Related Tutorials