Skip to main content
December 19, 2012
Question

Reset multiple images' clipping paths to "None"

  • December 19, 2012
  • 2 replies
  • 5812 views

In InDesign CS4, is there a way to check all images at once and reset their clipping paths to "none?" I work on catalogs that have several thousand photos (tif, Photoshop, and a few jpg files) in each one. We break the catalogs into approximately 10 sections/documents then organize them into a book file/palette, so there are only a few hundred images in each section/document. Originally a clipping path was applied to the photos (either a Photoshop clipping path or a "detect edges" path), but we now save them with transparency, so I'd like to be able to turn them all of at once (especially the "detect edges" paths).

Any suggestions? I know basically nothing about scripting, so writing a script wouldn't work in this case.

I appreciate any help...

Thanks,

Lloyd

This topic has been closed for replies.

2 replies

Vamitul
Brainiac
December 20, 2012

here you go:

# target indesign

function main() {

          var docs = app.documents.everyItem().getElements(),

                    l = docs.length;

          while(l--) {

                    try {

                              docs.rectangles.everyItem().images.everyItem().clippingPath.clippingType = ClippingPathType.NONE;

                    } catch(e) {

                              alert(e);

                    }

                    alert('All done! You can go outside and play now!')

          }

}

app.doScript('main()', undefined, undefined, UndoModes.entireScript, 'Reset Clipping');

it works for all opened indesign files. I don't think it will work if you gave grouped pictures, buut i'm a bit short on time to tweak it now

Inspiring
December 20, 2012

Hi vamitul,

we've got a array here:

docs.rectangles.everyItem().images.everyItem().clippingPath

;-)

PleaseWork1978
Inspiring
August 10, 2017

@Peter – not hard at all:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

app.doScript(resetAllClippingPathsToActiveDoc, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Reset all Clipping Paths of the Active Document");

function resetAllClippingPathsToActiveDoc(){

    var d=app.activeDocument;

    var allGraphicsInDoc = d.allGraphics;

    for(var n=0;n<allGraphicsInDoc.length;n++){

        if(allGraphicsInDoc.hasOwnProperty("clippingPath")){allGraphicsInDoc.clippingPath.clippingType = ClippingPathType.NONE};

        };

};


Uwe


This works great, but can we get one to just remove clipping paths from SELECTED frames containing images etc?

Thanks again, almost there towards having the perfect clipping path removal script.

Thanks everyone.

Peter Spier
Community Expert
December 19, 2012

I've moved this to the scripting forum. You may not know scripting, but these guys do, and I'm pretty sure one of them will help you out.