Copy link to clipboard
Copied
I'm looking for the magic numbers used inside all the Color Range Select Options ( colors and tones options ).
Is there any document giving this numbers ?
Copy link to clipboard
Copied
I don’t seem to understand what you mean – »magic numbers«?
Could you please explain with the help of screenshots or sketches?
What relevance does it have for your workflow?
Copy link to clipboard
Copied
If we record with the ScriptListener a Cyans or Shadows selection Color Range, we get a code that doesn't contain any number, instead we get a code that tells us the option that was selected in these cases we would get a code with stringIDToTypeID( "cyans" ) or stringIDToTypeID( "shadows" ).
I would like to know what are the min and max Lab numbers behind the cyans or shadows Color Range select options.
To make it even more clear :
How to transform this code,
var descriptor = new ActionDescriptor();
descriptor.putEnumerated( stringIDToTypeID( "colors" ), stringIDToTypeID( "colors" ), stringIDToTypeID( "cyans" ));
descriptor.putInteger( stringIDToTypeID( "colorModel" ), 0 );
executeAction( stringIDToTypeID( "colorRange" ), descriptor, DialogModes.NO );
into something like :
var descriptor = new ActionDescriptor();
descriptor.putInteger( stringIDToTypeID( "fuzziness" ), ??????? );
var descriptor2 = new ActionDescriptor();
descriptor2.putDouble( stringIDToTypeID( "luminance" ), ??????? );
descriptor2.putDouble( stringIDToTypeID( "a" ), ??????? );
descriptor2.putDouble( stringIDToTypeID( "b" ), ??????? );
descriptor.putObject( stringIDToTypeID( "minimum" ), stringIDToTypeID( "labColor" ), descriptor2 );
var descriptor3 = new ActionDescriptor();
descriptor3.putDouble( stringIDToTypeID( "luminance" ), ??????? );
descriptor3.putDouble( stringIDToTypeID( "a" ), ??????? );
descriptor3.putDouble( stringIDToTypeID( "b" ), ??????? );
descriptor.putObject( charIDToTypeID( "Mxm " ), stringIDToTypeID( "labColor" ), descriptor3 );
descriptor.putInteger( stringIDToTypeID( "colorModel" ), 0 );
executeAction( stringIDToTypeID( "colorRange" ), descriptor, DialogModes.NO );
Copy link to clipboard
Copied
I would like to know what are the min and max Lab numbers behind the cyans or shadows Color Range select options.
By @Panchromatic
That makes the question more clear. Too bad we do not have Chris Cox around there anymore...
Copy link to clipboard
Copied
Too bad we do not have Chris Cox around there anymore...
A pity indeed.
Copy link to clipboard
Copied
Hi,
I think Moderators should have the possibility to contact the Ps Team for this kind of question... Yeah, power to the Moderators !!!!
Copy link to clipboard
Copied
Pinging @Tom Ruark
Copy link to clipboard
Copied
I don't have any further information and would try looking around Adobe Help X content or maybe an instructor that has done a deep dive into that dialog.
Copy link to clipboard
Copied
Thank you very much for chiming in during Max, Tom!
Unfortunately, Helpx is not exactly verbose: https://helpx.adobe.com/photoshop/using/selecting-color-range-image.html
https://www.photoshopessentials.com/basics/selections/color-range/ explains it better, but does not go into the math behind each slider, or about the code generated when using CR...
Copy link to clipboard
Copied
Thank, for having tried.
Copy link to clipboard
Copied
I doubt that Lab is involved at all (except for Lab-images), but that the calculations are done on the RGB-(or CMYK)-values.
Edit: A quick test (with two images of identical RGB-pixels but with different Color Spaces) seems to confirm the suspicion.
Copy link to clipboard
Copied
I would like to know what are the min and max Lab numbers behind the cyans or shadows Color Range select options.
What relevance does it have for your work?
Copy link to clipboard
Copied
Hi,
It could help to modify some scripts where I used Color Range with this kind of parameter (one of the select tone option or one of the select color option). I would like to test those scripts with a sligthly different selection, so it could be nice to know with what I used in the old version.
Copy link to clipboard
Copied
Hi, I guess you've maybe found this page already with some suppositions: https://stackoverflow.com/questions/19986198/emulate-photoshops-color-range-algorithm
@Scott_Valentine has written a book on blending modes, not sure if he touched on Color Range: https://www.adobepress.com/store/hidden-power-of-blend-modes-in-adobe-photoshop-9780321823762?w_ptgr...
Copy link to clipboard
Copied
Not really what I'am after, but it was interesting to read.
Copy link to clipboard
Copied
I have made some discoveries for the Tones Select Options.
There are some other operations under the hood before the strict Color Range operation.
If I'm right there is a BW linear mapping of the image that is involved. After that, for the Color Range Shadows selection the magic numbers could be fuziness 45, L 27, a 0, b 0. For Highlights, I haven't already find the right numbers but something like fuziness 41, L79, a 0, b 0 seems very close.
Edited, cause it was total b...t !!!!
Copy link to clipboard
Copied
Have you tried with pixel-identical images but at different Color Spaces?
In a quick test I got identical results in sRGB and eciRGB v2, so it seems to me that Lab may not play a role here at all.
Copy link to clipboard
Copied
OK, you are right...back to start point !!!!
Copy link to clipboard
Copied
Some infos about color range taken from a book (in the real world series) dating back from CS3 :
- for the select tones (shadows, midtones, highlights) options :
"Photoshop decides whether to select a pixel (or how much to select it ) based on its Lab luminance value"
with L value in lab mode being
for shadows
fully slected pixels = 1-40
partially selected pixels = 40-55
for midtones
fully slected pixels = 55-75
partially selected pixels = 40-55 and 75-85
for highylights
fully slected pixels = 80-100
partially selected pixels = 75-85
- for the select color (red, green, ...) options :
"The greater the difference between the color you choose and the other primaries,
the more the pixel is selected. (To get really tweaky for a moment, the percentage the
pixel is selected is the percentage difference between the color you choose
and the primary color with the next highest value.)"
___________________ end of the excerpt ____________________
With a BW gradient map adj layer I can reproduce, almost identically, the shape of the selection for a tones selection.
With a selective color adj layer, by adjusting the black slider, I can almost identically the shape of the selection for a color selection.
I'm still interested on how to exactly repdroduce selection resulting from a color range selection with a tones or color select option.
Copy link to clipboard
Copied
If I understand, you want to identify specific values (or ranges of values) that will give you a selection result similar to what Color Range produces when you click on a discrete color. Is that correct? You plan to use that information to automate selections?
Copy link to clipboard
Copied
Yes, that is what I'm after.
For example, how to obtain the same selection as the one we get when we use one of the Color Range option inside the Select Menu (Reds,Yellows, Greens, ...Shadows,Highlights, Midtones)
First, I was thinking of finding the magic numbers for use inside Color Range AM Code from Sampled Color(s) with the Color Range Eyedroppers but I'm not sure it's possible to obtain the same result as using the Color Range AM Code from a Select Pop-Up Menu option.
I have also tried a different approach by using other tools like gradient or selective color adj layers.
In all case, the resulting selection I have obtained are not exactly identical to the Color Range non eyedropped ( one of Reds,Yellows... or Shadows...inside the Select menu ) Selection.
Copy link to clipboard
Copied
Thank for chiming in, @The Scott Valentine !