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

Set InDesign image Clipping Path to NONE

New Here ,
Jun 10, 2025 Jun 10, 2025

I'm new to scripts in InDesign, and need a script to switch selected images Clipping Path to type NONE.

 

I have found a great script that switches the clipping path on if there is a photoshop clipping mask saved in the image, but I don't know enough to back engineer it. Any help greatly appreciated.

 

Here is the script to switch clipping paths on:

function main(){
for(var i = 0; i < cur_obj.length; i++){
try{
if(typeof cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0] != 'undefined'){
cur_obj[i].graphics[0].clippingPath.appliedPathName = cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0]
}
}
catch(e){}
}
}
 
try{var cur_obj = app.selection}
catch(e){exit()}
 
if(typeof cur_obj != 'undefined' && cur_obj.length != 0){
app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'clip')
}
TOPICS
Scripting
137
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 Expert ,
Jun 10, 2025 Jun 10, 2025

In your loop, just need this line, probably wrapped in a try/catch block.

 

cur_obj[i].graphics[0].clippingPath.clippingType = ClippingPathType.NONE;

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 ,
Jun 10, 2025 Jun 10, 2025

Thank you Brian,

I have absolutely no experience in writing scripts. Would you be able explain where I would insert that and what I would need to remove from the original 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
Community Expert ,
Jun 10, 2025 Jun 10, 2025
LATEST

If you just want to do it for a selection, you can use this one line (assuming the containing rectangle, not the image itself, is selected). 

 

try { app.selection[0].graphics[0]..clippingPath.clippingType = ClippingPathType.NONE; } catch(e) {}

If you want to do it for all graphics in a doc, then you'd use that loop you posted with this change: 

function main(){
var graphics = app.activeDocument.allGraphics;
for(var i = 0; i < graphics.length; i++){
try{
graphics[i].clippingPath.clippingType = ClippingPathType.NONE;
}
}
catch(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