A IndexColorModel is used to represent the color table of a GIF image.

    // Get GIF image
    Image image = new ImageIcon("image.gif").getImage();
    
    // Get the color model; this method is implemented in
    // e662 取的图像的色彩模型
    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();

 

Related Examples

相关文章:

  • 2021-09-23
  • 2021-07-14
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2021-06-19
  • 2021-12-07
  • 2022-01-07
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
相关资源
相似解决方案