How to convert CMYK to RGB programmatically in indesign

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.

+1
4

:

1 RGB, 1 CMYK. , .

CMYK RGB ,

CMYK RGB -

+5

.

CMYK RGB , , , . , , .

CMYK RGB color profile, , CMYK.

:

  • image.tif, CMYK.
  • ICC, . (.. USWebCoatedSWOP.icc ).

"" RGB.

, , ICC.

, , ( !!!), - ICC - , LittleCMS.

, COM InDesign. , Photoshop, Illustrator Acrobat API COM.

, , Adobe API- API, , CorelDRAW.

: -, InDesign , - . . (1.5.9. ).

+2

( CMYK), ( RGB).

, - . , . , , ICC (. Www.color.org), , , , , .. : , CMYK, , RGB, . ICC (, LittleCMS , Mac OS, Windows Adobe) .

, , , - , ", " , , . , "" .

, , , , .

+2
double cyan = 35.0/100.0;
double magenta = 29.0/100.0;
double yellow = 0.0;
double black = 16.0/100.0;

100, 0 1

        R=255*(1-cyan)*(1-black);
        G=255*(1-magneta)*(1-black);
        B=255*(1-yellow)*(1-black);

,

0

Source: https://habr.com/ru/post/1780050/


All Articles