首页 > 其他 > 详细

e663. 在gif图像中获取透明和色彩的数量

时间:2018-09-02 22:59:38      阅读:213      评论:0      收藏:0      [点我收藏+]

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

e663. 在gif图像中获取透明和色彩的数量

原文:https://www.cnblogs.com/borter/p/9575536.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!