JAVA彩色图片变灰处理

File file = new File("F:/firefox.png");
File destFile = new File("F:/pic/" + System.currentTimeMillis() + ".png");
BufferedImage image = ImageIO.read(file);
BufferedImage destImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
ColorConvertOp cco = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
cco.filter(image, destImage);
ImageIO.write(destImage, "png", destFile);

 

原图:

处理后:

 

posted @ 2014-11-24 14:56  rubekid  阅读(1088)  评论(0编辑  收藏  举报