CMYK 2 RGB problem
I have a problem converting CMYK color to RGB. There are many formulas on the internet for converting it, but for example when I convert CMYK (0,100,100,0) to RGB it gets the value (255 0 0), but in Adobe Photoshop RGB the value is (237,28,36), and I want this one. Does anyone know how to convert it using java or .NET?
a source to share
Other questions ask the same thing:
- https://stackoverflow.com/questions/tagged/rgb+cmyk
- How to convert CMYK to RGB programmatically in indesign
- Convert RGB color to CMYK?
The general gist of your problem is that Photoshop is applying a color profile where like you just do a direct conversion. Please see my answers to some other questions as I feel like I answered this question to death.
If you want good results, you need to apply a color profile. In .NET, you can do it like this (assuming the original CMYK components are in the range 0 to 255):
float[] colorValues = new float[4];
colorValues[0] = c / 255f;
colorValues[1] = m / 255f;
colorValues[2] = y / 255f;
colorValues[3] = k / 255f;
System.Windows.Media.Color color = Color.FromValues(colorValues,
new Uri(@"C:\Users\me\Documents\ISOcoated_v2_300_eci.icc"));
System.Drawing.Color rgbColor = System.Drawing.Color.FromArgb(color.R, color.G, color.B);
Note that two different Color classes are used from two different namespaces. And you probably need to add the PresentationCore DLL as a reference.
The required color profile can be downloaded from the eci.org download section . This is part of a large zip file containing multiple profiles. They explicitly recommend using the ISO Coated v2 300% (ECI) profile.
There is a nice website showing a CMYK to RGB color conversion with a color profile at work.
If you need to convert a full image from CMYK to RGB, there are special classes in this namespace for that.
a source to share