首页 > 其他 > 详细

e662. 取的图像的色彩模型

时间:2018-09-02 22:15:44      阅读:193      评论:0      收藏:0      [点我收藏+]
// This method returns the color model of an image
    public static ColorModel getColorModel(Image image) {
        // If buffered image, the color model is readily available
        if (image instanceof BufferedImage) {
            BufferedImage bimage = (BufferedImage)image;
            return bimage.getColorModel();
        }
    
        // Use a pixel grabber to retrieve the image‘s color model;
        // grabbing a single pixel is usually sufficient
         PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
         try {
             pg.grabPixels();
         } catch (InterruptedException e) {
         }
        ColorModel cm = pg.getColorModel();
        return cm;
    }

 

Related Examples

e662. 取的图像的色彩模型

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

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