Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting RGB to CMYK , Using ICC Profile

I'm about to converting RGB color to CMYK for printing purpose. scale of this conversion is Adobe Photoshop ( Image -> Mode -> CMYK color )

I tried 2 solution , but none of them return the right value :

Solution 1 - Using .NET Framework

At first , I followed by these steps

  • Download ICC profiles (windows version) from Adobe

  • Convert the #color to CMYK

  • used System.Windows.Media.Color.FromValues // return Color MSDN

  • string convretedColor = string.Format("#{0:X2}{1:X2}{2:X2}", _color.R, _color.G, _color.B)

here is the result :

  • profile : CoatedFOGRA27.icc

  • Original Color : #2f00ff

  • Converted Color : #3b4996

  • Result of conversion With Adobe Photoshop (same profile) : #3b4996 not even close!

Solution 2 - Using Windows Color System ( WCS )

I also tried the Codo's solution with same procedure

here is the result :

  • Profile : CoatedFOGRA27.icc

  • Original Color : #2f00ff

  • Converted Color : #2032FF

  • Photoshop : #3b4996

JSFiddle for compare

EDIT

According to Codo's Comments, I think, I have some fundamental problems of understanding colors concept !! ( please correct me if I'm wrong )

For any color, we have different color models , RGB , CMYK, ...

RGB shows the combination of (Red Green Blue) to generate color and CMYK as well (Cyan Magenta Yellow * ). the values of these models can easily convert to each-other.

for example :

  • RGB HEX : #2F00FF

  • RGB : 47 - 0 - 255

  • CMYK : 0,816 - 1,000 - 0,000 - 0,000

Almost, all monitors use RGB to shows the colors.the printed color (because of using Ink instead of LED o ...) is totally different from the color that you see on monitor/

For this issue, Image Editors like Photoshop use CMYK **MODE**.In this mode , if you select the RGB color, the editor convert it to color that you see after printing and shows that to screen.this conversion is absolutely depend on color Profiles ( here ICC )

EDIT 2

enter image description here

like image 385
Mironline Avatar asked Aug 16 '13 11:08

Mironline


People also ask

Can you just convert RGB to CMYK?

To create a new CMYK document in Photoshop, go to File > New. In the New Document window, simply switch the color mode to CMYK (Photoshop defaults to RGB). If you're wanting to convert an image from RGB to CMYK, then simply open the image in Photoshop. Then, navigate to Image > Mode > CMYK.

How do I convert RGB to CMYK without losing color?

PRO TIP: When converting RGB to CMYK, it is important to not lose color in Illustrator. To do this, make sure to click on the “Edit” menu and then “Color Settings.” From here, change the color mode to CMYK and then click on the “OK” button.


2 Answers

Let me try to help you sort it all out:

1) RGB is a format to describe a color value. i.e.: 255,0,0 for red.

2) HSV is another format to describe a color value. i.e.: 0,100,100 for red

Those two are the only ones that will give you the digitally accurate color,
you can think of them as digital representation of the color or it's real DNA and thanks god the monitor is able to present them - exactly for what they are.

Let's move on:

3) Lab is another format to describe a color value.

54,81,70 for red RGB which is (255,0,0) however..
54,81,70 can also apply to a different RGB.. (254,0,0)

why is that? because Lab format is designed to approximate human vision.
and for the human eye there is no difference between (255,0,0) and (254,0,0)
well.. not really accurate to say that for the human eye..
more accurate to say the model which is being used to get the Lab color which intends to..

4) CYMK is designed to tell the printer what mixes of Cyan, Yellow and Magenta to press to the paper and K (key or black) for how much dark to press into that mix.

So 0%,100%,100%,0% will give us the mixture for red..
and 0%,50%,50%,0% will give us pink.

Let's move on:

Your effort is to adjust the RGB which seen in the monitor to the CMYK of the printer.
God knows why you want to do that when it's been fully automatic and handled by the driver for years..
But I assume you have your reasons, So let's continue,
Each printer has a slightly different CMYK values to mix to get to that specific red..

And this is where ICC profiles come into action..
They give a standard for RED in example by providing table for (1) the original RGB-RED and (2) the CMYK red in a specific printer.

So converting from RGB(Red) to CMYK(red) according to an ICC profile is logical to wish for.

But if you try to convert back - you will notice that the CMYK for RED according to a specific profile can have multiple digital RED values..

This is because the digital color resolution is much more accurate than what comes out to a printed paper, another way to look at it is to say that a specific printer ICC could have been built upon Lab.

Now I know.. I know.. you probably already knew most of if not all of it.
(I wrote it just to be sure we both on same page in the book.)

So, when you say "none of them return the right value" (Assuming them = the conversions) what exactly do you mean?! All seems right to me, as In fact they do return the right value - for printing purposes.

like image 191
G.Y Avatar answered Sep 22 '22 04:09

G.Y


May be this (untested) snippet helps a bit - it uses the the .NET api for ImageMagick.

MagickReadSettings settings = new MagickReadSettings();
settings.ColorSpace = ColorSpace.CMYK;
using (MagickImage image = new MagickImage())
{
  image.AddProfile(ColorProfile.CMYK);
  image.Read("image_rgb.tiff", settings);
  image.Write("image_cmyk.tiff");
}

If you can use the commandline this will also do the job:

convert image_rgb.tiff -profile "RGB.icc" -profile "CMYK.icc" image_cmyk.tiff
like image 30
Jost Avatar answered Sep 23 '22 04:09

Jost