Skip to main content
ava74628296
Inspiring
February 19, 2016
Answered

Selection by color

  • February 19, 2016
  • 2 replies
  • 915 views

How can you make a selection based on color

For example, all pixels white?

Something like this:

app.activeDocument.Selection.select(0,White);

Thanks!

This topic has been closed for replies.
Correct answer c.pfaffenbichler

Use the AM code ScriptingListener.plugin creates when you perform the corresponding operation (in this case this could for example be Color Range).

2 replies

Participating Frequently
February 20, 2016

Bonjour

You can use the function selectColorRange()  - xbytor in xtools ( xtools ) - stdlib.js

"

//RechercheBlanc.jsx

//RechercheBlanc.jsx

//Recherche une couleur

var chercheCouleur = new SolidColor();

chercheCouleur.rgb.red=255;

chercheCouleur.rgb.green=255;

chercheCouleur.rgb.blue=255;

selectColorRange(chercheCouleur);

function selectColorRange(scObj)

{

    var desc = new ActionDescriptor();

    desc.putInteger( charIDToTypeID( "Fzns" ), 0 );

    var cDesc = new ActionDescriptor();

    cDesc.putDouble( charIDToTypeID( "Rd  " ), scObj.rgb.red);

    cDesc.putDouble( charIDToTypeID( "Grn " ), scObj.rgb.green);

    cDesc.putDouble( charIDToTypeID( "Bl  " ), scObj.rgb.blue );

    desc.putObject( charIDToTypeID( "Mnm " ), charIDToTypeID( "RGBC" ), cDesc );

    desc.putObject( charIDToTypeID( "Mxm " ), charIDToTypeID( "RGBC" ), cDesc );

    executeAction( charIDToTypeID( "ClrR" ), desc, DialogModes.NO );

}

"

ava74628296
Inspiring
February 20, 2016

Thank you

It really select the white, but I do not understand anything, what it ActionDescriptor, PutDouble?

And whether it is possible to increase the range of selection, have not only one color?

Participating Frequently
February 21, 2016

1/

you gotta ask .... xbytor


2/


By using methodes store() load()  - SelectionType.INTERSECT // EXTEND REPLACE ???

c.pfaffenbichler
Community Expert
c.pfaffenbichlerCommunity ExpertCorrect answer
Community Expert
February 19, 2016

Use the AM code ScriptingListener.plugin creates when you perform the corresponding operation (in this case this could for example be Color Range).