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);
原图:
处理后: