public static bool IsImageSrgbJpeg(System.Drawing.Image someImage) { try { var val = someImage.GetPropertyItem(34675); System.Drawing.Imaging.ImageFlags flagValues = (System.Drawing.Imaging.ImageFlags)Enum.Parse(typeof(System.Drawing.Imaging.ImageFlags), someImage.Flags.ToString()); return(flagValues.ToString().Contains("HasRealDpi")); } catch (ArgumentException ae) { return(true); } catch (Exception er) { return(false); } }
public static bool isFileACMYKJpeg(System.Drawing.Image image) { System.Drawing.Imaging.ImageFlags flagValues = (System.Drawing.Imaging.ImageFlags)Enum.Parse(typeof(System.Drawing.Imaging.ImageFlags), image.Flags.ToString()); if (flagValues.ToString().ToLower().IndexOf("ycck") == -1) { // based on http://www.maxostudio.com/Tut_CS_CMYK.cfm bool ret = false; try { int cmyk = (image.Flags & (int)ImageFlags.ColorSpaceCmyk); int ycck = (image.Flags & (int)ImageFlags.ColorSpaceYcck); ret = ((cmyk > 0) || (ycck > 0)); } catch { } return(ret); } return(true); }