English 中文(简体)
CMYK 2 RGB Problem
原标题:
  • 时间:2010-04-20 16:09:01
  •  标签:
  • colors
  • cmyk

I have a problem with converting a CMYK Color to RGB. In the internet there is many formulas to convert it but for example when I convert CMYK (0,100,100,0) to RGB, it get value (255 0 0) but in Adobe Photoshop RGB value is (237,28,36) and I want this one. Is anybody know how to convert it with java or .NET?

问题回答

There are other questions asking the same thing:

The general gist of your problem is that Photoshop is applying a Color Profile where-as you are simply doing a direct conversion. Please see my answers to some of the other questions as I feel like I ve answered this question to death.

If you want good result, you need to apply a color profile. In .NET, you can do it like that (assuming the the original CMYK components are in the range between 0 and 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:UsersmeDocumentsISOcoated_v2_300_eci.icc"));
System.Drawing.Color rgbColor = System.Drawing.Color.FromArgb(color.R, color.G, color.B);

Note that two different Color classes from two different namespaces are used. And you probably need to add the PresentationCore DLL as a reference.

The required color profile can be downloaded from the downloads section of eci.org. It s part of a bigger ZIP file containing several profiles. They explicitly recommend to use the ISO Coated v2 300% (ECI) profile.

There s a nice web site showing the CMYK to RGB color conversion with the color profile at work.

If you need to convert a complete image from CMYK to RGB, there are special classes for this in the same namespace.

if you want photoshop like cmyk conversion then use JDeli java image library ; there is a class called EnumeratedSpace which does the job for you;

please do not forget to bit mask because return values are rgb bytes

ColorJizz can convert from RGB to CMYK and many other formats. There s a .NET version in there.





相关问题
using colors in calculated member

Im using this query in MDX for a calculate measure topcount(nonempty([StatusPlanes].[Status].Status.members,[Measures].[Planes]),1)(0).member_caption this will bring me this result Dimension1 ...

Using colors with MDX calculated measure

I m using this query in MDX for a calculated measure topcount(nonempty([StatusPlanes].[Status].Status.members,[Measures].[Planes]),1)(0).member_caption This will bring me this result Dimension1 ...

How can I convert a color image to grayscale in MATLAB?

I am trying to implement an algorithm in computer vision and I want to try it on a set of pictures. The pictures are all in color, but I don t want to deal with that. I want to convert them to ...

Hex colors: Numeric representation for "transparent"?

I am building a web CMS in which the user can choose colours for certain site elements. I would like to convert all colour values to hex to avoid any further formatting hassle ("rgb(x,y,z)" or named ...

How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

How to change Gmap markers color?

I ve a custom google map with different points: Markers[0] = new Array(new GMarker(new GLatLng(45.0, 9.0)), "Location1", "<strong>Address Line</strong><br/>Some information"); ...

热门标签