Java BufferedImage to Gray Scale imageToGrayscale(BufferedImage img)

Here you can find the source of imageToGrayscale(BufferedImage img)

Description

image To Grayscale

License

Open Source License

Declaration

public static BufferedImage imageToGrayscale(BufferedImage img) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

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

    public static BufferedImage imageToGrayscale(BufferedImage img) {
        colorConvert.filter(img, img);/*ww w. j a  va2s .  c o m*/
        return img;
    }
}

Related

  1. imageToGrayscale(BufferedImage image)
  2. gray(BufferedImage src)
  3. grayImage(BufferedImage image)
  4. byteBufferToGrayBufferedImage(ByteBuffer buffer, BufferedImage bi)