views:

495

answers:

3

Hi,

I'm looking for an algorithm to convert an RGB color to CMYK. Photoshop is performing the conversion below:

R = 220 G = 233 B = 174

C = 15 M = 0 Y = 40 K = 0

+1  A: 

For example this, simply use Google ;)

Thomas Wanner
+2  A: 

Check out this link: http://www.codeproject.com/KB/applications/xcmyk.aspx. It gives this formula.

Black   = minimum(1-Red,1-Green,1-Blue)
Cyan    = (1-Red-Black)/(1-Black)
Magenta = (1-Green-Black)/(1-Black)
Yellow  = (1-Blue-Black)/(1-Black) 
37Stars
Note: While the conversion comes close, most of the time it won't match photoshop. Comparing the generated colors in photoshop will often produce different results too. There's no direct conversion, but it's often close enough.
Will Eddins
The code found here is using the formula above:http://www.javascripter.net/faq/rgb2cmyk.htm
Junior Developer
+2  A: 

The conversion from RGB to CMYK is dependent on the physical device/process being used to lay down the CMYK ink. These are represented in software as Color Profiles. ICC and ICM color profiles of physical devices determine the resulting colors.

If you are not concerned with true representation on a physical device then use the direct conversion formulas in other posts.

If, however, you are concerned with this aspect, then you need to use a either the Windows Color Management APIs or something like LittleCMS to do the color conversions for you (as they apply the proper color profile during the conversion).