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

Script to apply clipping path-detect edges to selected image

Community Beginner ,
May 30, 2023 May 30, 2023

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
675
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

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);
}
Translate
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);
}
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
Community Beginner ,
May 30, 2023 May 30, 2023

This worked flawlessly, thank you so much!

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

This worked perfectly, thank you!

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