Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Selecting custom pixels

New Here ,
Nov 13, 2017 Nov 13, 2017

I have binary mask image. What the most convenient way to make selection with form of this mask?

TOPICS
Actions and scripting
826
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
People's Champ ,
Nov 13, 2017 Nov 13, 2017

If I understood correctly, then you can make a selection from the mask like this

app.activeDocument.selection.deselect();

app.runMenuItem(stringIDToTypeID("addUserMaskToSelection"));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 14, 2017 Nov 14, 2017

This works but there is also a step which i make with hands (Layer Mask > From Transparence). How do i made it in script?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Nov 14, 2017 Nov 14, 2017
LATEST

selection_from_channel("Trsp");

//selection_from_channel("Msk ");

function selection_from_channel(ch_name)

    {

    try {

        var d = new ActionDescriptor();

        var r1 = new ActionReference();

        var r2 = new ActionReference();

        r1.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );

        r2.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( ch_name ) );

        d.putReference( charIDToTypeID( "null" ), r1 );

        d.putReference( charIDToTypeID( "T   " ), r2 );

        executeAction( charIDToTypeID( "setd" ), d, DialogModes.NO );

        }

    catch(e) { alert(e);}

    }

Also can use 4-chars names

"RGB "

"Rd  "

"Grn "

"Bl  "

"Lab "

"Lght"

"A   "

"B   "

"CMYK"

"Cyn "

"Mgnt"

"Yllw"

"Blck"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines