如何判断jpg图片是RGB模式还是CMYK模式?

解决方案 »

  1.   

    public static bool IsCMYK(System.Drawing.Image img)
    {
         bool isCmyk;     if ((GetImageFlags(img).IndexOf("Ycck") > -1) || (GetImageFlags(img).IndexOf("Cmyk") > -1))
         { isCmyk = true; }
         else
         { isCmyk = false; }     return isCmyk;
    }参见
    http://blog.csdn.net/johnsuna/archive/2007/09/11/1781309.aspx
      

  2.   

    PHP的函数read_exif_data可以读出颜色模式。如果你懂C语言。可以从中提取出来:
    https://github.com/php/php-src/blob/master/ext/exif/exif.c其中。你浏览器里Ctrl+F搜索变量isColor;如果为0代表改图片为RGB、0为CMYK。
    PS:如果从中提出了,请发一份我Email:[email protected]
     3Q!