Java examples for 2D Graphics:BufferedImage Color
Converting a Colored Buffered Image to Gray
import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.ColorConvertOp; public class Main { public static void main(String[] args) throws Exception { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); ColorConvertOp op = new ColorConvertOp(cs, null); /*from ww w .jav a2 s . com*/ BufferedImage bufferedImage = null; bufferedImage = op.filter(bufferedImage, null); } }