Change color in java.awt.Image?

2019-08-25 03:47发布

问题:

I have an java.awt.Image object. It is an colorful image. Here is my code:

ImageIcon icon = new ImageIcon(bytes);
Image image = icon.getImage();

How can I make it black & white?

回答1:

Look into using a BufferedImageOp. See Drawing an Image in the Java Tutorials for more details.