convert Image To Gray Scale - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage Convert

Description

convert Image To Gray Scale

Demo Code


//package com.java2s;

import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;

public class Main {
    private static ColorConvertOp colorConvertOperation = new ColorConvertOp(
            ColorSpace.getInstance(ColorSpace.CS_GRAY), null);

    public static BufferedImage convertImageToGrayScale(
            BufferedImage bufferedImage) {
        return colorConvertOperation.filter(bufferedImage, null);
    }/* ww w  .  j  a  va 2s .c o  m*/
}

Related Tutorials