skip to Main Content

I need to convert RGB value to CMYK as in Adobe Photoshop/ Mac ColorPicker. All the colors in RGB cannot be achieved in CMYK. But the algorithms I have found such as rgbtocmyk does’nt produce the result I am expecting. For Ex: rgb(0,0,255) which is the purest blue is not supported in CMYK. In this case, I need to find the nearest blue supported by CMYK gamut. Can you give me any reference to it or the algorithm used?

2

Answers


  1. That is simply not true. All RGB colors can be represented as CMYK, but not the opposite. The link you sent works, but it seems the range of the three R, G, B components is [0,255], while the range of the four C, M, Y, K components is [0,1]. This is usual, the RGB coordinates expressed as integers and the CMYK as floating-point numbers. Almost all the algorithms you can find on the web will work like this.

    PS: here is a sample implementation of the algorithm, http://www.javascripter.net/faq/rgb2cmyk.htm .

    EDIT:

    I’m afraid it can be long to explain in detail, but here we go. On one hand, you have the components of each color. On the other hand, you have the display of a certain color on a device. Since each color is physically a function on the wavelength, the RGB representation is a rough approximation of that function.

    The problem with that arises when you need to match a certain color on a device. For instance, two screens can show slightly different colors for the same RGB color. To overcome the difficulty of perceptually matching a color with the displayed value on a given device, there exist the so-called color profiles, which specify how the device matches the RGB (or CMYK, or LAB, or whatever color system you use) coordinates with the actual displayed color.

    As I understand the situation, the conversion you want to perform involves color profiles. Moreover, when we say RGB we are usually talking about screens, and when we say CMYK we are usually talking about printers (the CMYK components usually specify the amount of ink pigments the printer uses to represent the color). The Wikipedia entry can give you more information on this: https://en.wikipedia.org/wiki/Color_space

    Let me finally point out that the conversion you want to perform involves exploring the color profiles associated to the involved devices and is not trivial. However, the first step in RGB->CMYK conversion would be to do a straight conversion with the simple algorithm we discussed first. Then, apply if needed a color correction.

    Login or Signup to reply.
  2. There is no simple conversion of CMYK colors. And the interpretation of CMYK colors depends on the printing condition (the combination of inks, paper, printer, printing process, etc.). This is because the mixture of inks (or dyes or any other colorants) is very complex to describe, just as much as mixtures of light (which is what RGB is based on), if not more so. In practice, a given printing condition is calibrated and characterized by printing CMYK color patches and measuring those patches using a color-measuring device under controlled lighting and measurement conditions. Only if a printing condition is well-characterized is an accurate conversion between RGB and CMYK possible for that printing condition. See also my article section “CMYK and Other Ink-Mixture Color Models“.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search