I have a Illustrator document with default RGB color mode. The Color Picker displays the RGB values of selected object and it also displays HSB (Hue, Saturation, Brightness) and CMYK (Cyan, Magenta, Yellow) values of the selected object. But I do not understand how Illustrator calculates these (HSB and CMYK) values. I found RGB-to... conversion functions on the web which all seem to be based on the same algos (for example: https://gist.github.com/felipesabino/5066336 ) but the CMYK and HSB value obtained with these do not match with the values from Color Picker ? Can anybody please tell me how (algo?) Illustrator calculates the HSB and CMYK values from the RGB values in the Color Picker?
So far I understood that RGB to CMYK conversion depends on the type of printer which is used, but I thought that, as long as there is no printer selected the RGB to CMYK shall follow a default scheme/algo? I’m asking for help because I would like to use the HSB and CMYK values which are displayed in the Color Picker as guidelines for manually mixing colors for hobby painting purposes (on a ‘real’ palette and canvas). I found the CMYK and HSB values displayed in the Color Picker more realistic than the ones computed by the algo from URL above, for example for RGB color R=246 G=109 B=164 the Color Picker displays S=55%, B=96%, C=0%, M=70%, Y=3% K=0% whereas the algo from URL above calculates/converts to C=0%, M=54%, Y=32%, K=4% ?
Many thanks in advance for your time and advice!
"I found RGB-to... conversion functions on the web which all seem to be based on the same algos (for example: https://gist.github.com/felipesabino/5066336 " Yes, these are ALL WRONG . Every web page, I have ever seen to make this conversion is wrong. These are made by people who can read a formula, but do not understand color management.
Conversion depends on the RGB and CMYK profile in use. Sites which offer to convert without choosing a profile are like - well, like a site offering to convert between currencies without asking you the currency! "Hey, 3.00 is worth 7.54! That's great, What currency? I don't know, some currency or other."
I love this comparison.
I looked at your code. Part of RGB to CMYK processing is this:
result.k = Math.min( 1 - r, 1 - g, 1 - b );
result.c = ( 1 - r - result.k ) / ( 1 - result.k );
result.m = ( 1 - g - result.k ) / ( 1 - result.k );
result.y = ( 1 - b - result.k ) / ( 1 - result.k );
This is nice simple code. I know, I have used it myself. But from the point of view of colour accuracy it is a joke. (Sadly, a joke repeated all over the internet, and it doesn't get any funnier). It supposes (for example) that RGB cyan and CMYK cyan are equivalent colours. Well, only from the point of view of the person looking for easy code. Anyone who ever printed anything will know this is just false.
var fill_color = new RGBColor();
fill_color = selectedItems[i].fillColor;
color_string = fill_color.red.toString() + "_" + fill_color.green.toString() + "_" + fill_color.blue.toString();
but it seems there is no such equivalent CMYL or HSB color type in JavaScrip Object reference ?
Thank you in advance for your help! Kind regards
Copy link to clipboard