// Get GIF image
Image image = new ImageIcon("image.gif").getImage();

// Get the color model; this method is implemented in
// Getting the Color Model of an Image
IndexColorModel colorModel = (IndexColorModel)getColorModel(image);

// Get transparent pixel
int trans = colorModel.getTransparentPixel();
if (trans == -1) {
    // There is no transparent pixel

// Get the number of colors
int numColors = colorModel.getMapSize();

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.