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

Script to apply clipping path-detect edges to selected image

Community Beginner ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

I'm looking for a simple script to apply clipping path>detect edges to whatever image is selected. I'm a bit new to scripting, any ideas?

TOPICS
Scripting

Views

528
Translate

Report

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

correct answers 1 Correct answer

Community Expert , May 30, 2023 May 30, 2023

Something like this: 

try {
    var sel = app.selection[0];
    if (sel.graphics.length) {
        sel.graphics[0].clippingPath.clippingType = ClippingPathType.DETECT_EDGES;
    }
    else {
        sel.clippingPath.clippingType = ClippingPathType.DETECT_EDGES;
    }
} catch(e) {
    //alert(e);
}

Votes

Translate
Community Expert ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

Something like this: 

try {
    var sel = app.selection[0];
    if (sel.graphics.length) {
        sel.graphics[0].clippingPath.clippingType = ClippingPathType.DETECT_EDGES;
    }
    else {
        sel.clippingPath.clippingType = ClippingPathType.DETECT_EDGES;
    }
} catch(e) {
    //alert(e);
}

Votes

Translate

Report

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
Community Beginner ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

This worked flawlessly, thank you so much!

Votes

Translate

Report

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
Community Beginner ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

LATEST

This worked perfectly, thank you!

Votes

Translate

Report

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