May I ask the algorithm on how the Illustrator convert CMYK to RGB color codes.
On the AI, the generated RGB code is this:
I implement some convertion I found on the internet: https://gist.github.com/felipesabino/5066336
but the converted values are different.
The conversion value from RGB to CMYK depends on the Color settings.
For example, "North America Web / Internet" has the following values.
And for "North America Prepress 2", the values are shown below.
The CMYK value changes in this way due to various factors such as monitor color, printing ink color, and dot gain.
Therefore, https://gist.github.com/felipesabino/5066336 which does not consider such factors, does not give an accurate CMYK value.
Illustrator, and other Adobe applications use Color Management.
ICC profiles part of a CMS (Color Mngmt. System) are used bidirectionally to convert from different color spaces between RGB and CMYK.
That conversion does not factor in Displays, though monitors should be characterized and calibrated to provide an accurate and reliable precview. RGB to CMYK translation takes several factors in accont (GCR, dot gain,...) but they are included in the ICC profiles. The conversion Intent and Black Point Compensation, narrow or limit the type of conversion.
Please check Adobe.com for information, you may check basic tutorials like this: https://blog.frame.io/2019/08/26/color-management-abobe-cc/
RGB and CMYK are color modes or represent color models.
Any (same) color you choose may have different RGB value numbers in sRGB or Adobe RGB or ProPhoto rgb, because their color gamuts (range) is different in size and position.
CMYK color spaces are even more widely different, as they correspond or represent different printing conditions, the colors you get from inks and paper used for printing a newspaper in a rotative process, are more limited that those you get in a single fed flat sheet printing of a poster or a book cover.
Even more, that very same color, if it's reproducible, printed, on a newspaper and a magazine use different percentages of C, M, Y, K, inks in each process, on the first the web paper will get an inferior total amount of inksn(<220%), with a strong addition of Black and a reduction of CMY, colored inks. While the total amount of inks on a sheet fed process (Fogra39 orPSO Coated v.3) is close to 300%, and the use of (desaturating) Black ink is reduced.
Please select and set the appropiate Working spaces (their ICC profiles) in Color settings for RGB and CMYK, those suited to your workflow, and see on the Color Picker the conversions in each case. (No, it is not a lineal or first grade, transformation) select also the Intent and Black Point Comp. options.
Is it possible to extract the data(data tables if any?) from the Illustrator Color settings? So that we could integrate it to our system and able to compute the same way as the color setting selected on the Illustrator?
You would need to connect your system to the Adobe Color Engine (I don't know whether this is possible at all) and then have it do the calculations basd on color profiles.
The algorithm is based on a very simple test model of colour, not the real world. There is no algorithm. Colour management uses lookup tables specific to the CMYK inks that you will print with. These lookup tables are in the ICC profile. If you want to do your own conversion (1) make sure you understand the role of your selected RGB and CMYK profiles (2) use a CMM that manages the very complex task.
Many people look for simple algorithms that do not exist, and many sites offer "conversions" that are not based on any reality or actual knowledge of colour.
alert(app.convertSampleColor(ImageColorSpace.CMYK, [50,12,0,0], ImageColorSpace.RGB, ColorConvertPurpose.defaultpurpose));
run this script
Yup. Adobe always had issues with color management and color conversion. Even the simplest task, like keeping the same colors from Adobe After Effects to Adobe Media Encoder is too complicated for Adobe. Even the grays are completely messed up for years. YEARS!!! And now they bought Figma! God help us all.
There is no algorithm. I hope you got tested values for your CMYK conversion to RGB. Never in a million cases that I used Illustrator did I get a close to reality value for a conversion. Never ever. And its not like they could not check their issue for all these years. They could. But they don't. Pathetic. Ask any agency if they use Illustrator to convert. Nobody. For all these years, nobody. And yet these dudes think its a joke. Nope. Incompetence.
just look on the right-side panel for a lot of similar questions, hahaha, c'mon, guys, what the hell... :))))
There is no algorithm. I hope you got tested values for your CMYK conversion to RGB. Never in a million cases that I used Illustrator did I get a close to reality value for a conversion.
Learn color management. No modern publishing application works without it.