I have CMYK color space in indesign, I want to convert this as RGB color space, I have some codes, but I get the wrong data.
Some of the codes I tried are below
double cyan = 35.0;
double magenta = 29.0;
double yellow = 0.0;
double black = 16.0;
cyan = Math.min(255, cyan + black); //black is from K
magenta = Math.min(255, magenta + black);
yellow = Math.min(255, yellow + black);
l_res[0] = 255 - cyan;
l_res[1] = 255 - magenta;
l_res[2] = 255 - yellow;
@Override
public float[] toRGB(float[] p_colorvalue) {
float[] l_res = {0,0,0};
if (p_colorvalue.length >= 4)
{
float l_black = (float)1.0 - p_colorvalue[3];
l_res[0] = l_black * ((float)1.0 - p_colorvalue[0]);
l_res[1] = l_black * ((float)1.0 - p_colorvalue[1]);
l_res[2] = l_black * ((float)1.0 - p_colorvalue[2]);
}
return (l_res);
}
Values are C = 35, M = 29, Y = 0, K = 16 in the CMYK color space, and the correct RGB values are: R = 142, G = 148, B = 186.
In adobe indesign, using samples, we can change the mode to CMYK or RGB.
But I want to do this programmatically, can I get some kind of algorithm for converting CMYK to RGB, which will give the correct RGB values.
And one more question: if the alpha value for RGB is 1, then what will be the alpha value for CMYK?
Can someone help me solve these problems ... Thanks in advance.