How to discolor an ImageIcon
image? I hope that there are standard methods.
1 answer
You can use ColorConvertOp
. He pixel-by-pixel replaces the original image.
public BufferedImage getGreyScaled(BufferedImage src) { ColorConvertOp colorOp = new ColorConvertOp( ColorSpace.getInstance(ColorSpace.CS_GRAY), null); return colorOp.filter(src, null); }
To get ImageIcon
from BufferedImage
use the appropriate ImageIcon(Image image)
constructor ImageIcon(Image image)
- Klastno) works - Denis Kotlyarov
|
GrayFilter.createDisabledImage(Image i)
. It simulates the type of disabled buttons. Off Documentation - LEQADA