I have a problem were I need to detect if a WebImage is in CMYK-mode. Either by passing the WebImage to the function, or byte-array.
At the moment I have:
public static bool IsCMYK(Image img)
{
bool isCMYK;
if ((GetImageFlags(img).IndexOf("Ycck") > -1) || (GetImageFlags(img).IndexOf("Cmyk") > -1))
isCMYK = true;
else
isCMYK = false;
return isCMYK;
}
public static string GetImageFlags(Image img)
{
var flagVals = (ImageFlags)Enum.Parse(typeof(ImageFlags), img.Flags.ToString());
return flagVals.ToString();
}
Modified code from http://www.maxostudio.com/Tut_CS_CMYK.cfm
Not sure if its best practise or not.
How do I modify this code to detect CMYK from WebImage or byte array?
I solved it by using this code: