The PixelGrabber can be used to get a ColorModel instance that has a method to tell if alpha is supported. You just need to load a single pixel from the image to get the ColorModel.
PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false); pg.grabPixels(); boolean hasAlpha = pg.getColorModel().hasAlpha();
One Ping to “How to determine if Image supports alpha?”
Leave a Reply
You must be logged in to post a comment.