May 23

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();

written by objects \\ tags: , , ,

One Ping to “How to determine if Image supports alpha?”

  1. How to convert an Image to a BufferedImage? | web development helpdesk Says:

    […] a question How to determine if Image supports alpha? May […]


Leave a Reply

You must be logged in to post a comment.