In ASP.NET you can determine if a JPG is saved using the CMYK profile with the help of the System.Drawing.Imaging.ImageFlags enumeration,
http://msdn.microsoft.com/en-us/library/system.drawing.imaging.imageflags(VS.80).aspx
Let's say you have a basic aspx page where a user uploads a file and you need to tell,
1) is it a jpg?
2) is it using RGB?
Your aspx might be along the lines of,
<form id="form1" runat="server" enctype="multipart/form-data">
<asp:FileUpload ID="myUpload" runat="server" />
<asp:Button ID="submitButton" runat="server" Text="Submit" OnClick="Click_submitButton" />
<br /><br />
<asp:Literal ID="feedback" runat="server" />
</form>
and then for your code behind (C#) you can do,
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Click_submitButton(object sender, EventArgs e)
{
if (myUpload.HasFile && isUploadAJpeg(myUpload.PostedFile))
{
System.Drawing.Bitmap uploadedImage = new System.Drawing.Bitmap(myUpload.PostedFile.InputStream);
if (isFileACMYKJpeg(uploadedImage))
{
feedback.Text = "The file is a CYMK jpg";
}
else
{
feedback.Text = "This is a RGB jpg";
//it is a rgb jpg --> do something with it
}
}
else
{
feedback.Text = "You did not upload a jpg";
}
}
protected bool isUploadAJpeg(HttpPostedFile someFile)
{
if (someFile.ContentType == "image/jpg" || someFile.ContentType == "image/jpeg" || someFile.ContentType == "image/pjpeg")
{
return true;
}
return false;
}
protected bool isFileACMYKJpeg(System.Drawing.Image someImage)
{
System.Drawing.Imaging.ImageFlags flagValues = (System.Drawing.Imaging.ImageFlags)Enum.Parse(typeof(System.Drawing.Imaging.ImageFlags), someImage.Flags.ToString());
if (flagValues.ToString().ToLower().IndexOf("ycck") == -1)
{
return false;
}
return true;
}
}
Hope that helps!