2 Replies Latest reply on Sep 7, 2013 9:33 AM by Muppet Mark

    Detecting clipping path in EPS file

    Piotr Nowicki

      Hi All,


      I have problem with detecting clipping path settings in EPS.

      It's easy to find all cliping paths in file, they are listed in clippingPath.photoshopPathNames

      but when EPS is saved with clipping path selected, this path is always applied and clippingPath.clippingType is ClippingPathType.none

      I can't find any property which can be usefull to detect.





        • 1. Re: Detecting clipping path in EPS file
          drerol74 Level 2

          Hallo Piotr,


          Perhaps the following approach can help.


          The script places the eps (inside the selected frame) twice in a new layer: the first time with property epsImportPreferences.epsFrames = false and then with true. Afterwards the dimensions were compared and the layer deleted.


          Please note that it will only work if the paths are smaller than the image dimensions.



          #target InDesign


          var _eps = app.selection[0].epss[0];


          var _uerEPSFrames = app.epsImportPreferences.epsFrames;

          var _tempLayer = app.activeDocument.layers.add();


          try {

            if(_eps instanceof EPS && _eps.clippingPath.photoshopPathNames.length>0) {


              if(_eps.clippingPath.clippingType == ClippingPathType.NONE) {

                var _savedClippingPath = __savedWithClippingPath(_eps,_tempLayer);

                if(_savedClippingPath[0]) {

                  alert("Clipping path applied in Photoshop" + "\r\r" + "Path name: " + _savedClippingPath[1]);

                } else {

                  alert("EPS without applied clipping path (Photoshop and InDesign)");


              } else if (_eps.clippingPath.clippingType == ClippingPathType.PHOTOSHOP_PATH) {

                alert("Clipping path applied in InDesign" + "\r\r" + "Path name: " + _eps.clippingPath.appliedPathName);




          } catch(e) {




          app.epsImportPreferences.epsFrames = _uerEPSFrames;




          function __savedWithClippingPath(_curEPS,_tempLayer) {

            app.epsImportPreferences.epsFrames = false;

            var _tempEPS_1 = __placeFile (_curEPS,_tempLayer);

            app.epsImportPreferences.epsFrames = true;

            var _tempEPS_2 = __placeFile (_curEPS,_tempLayer);

            if(_tempEPS_1.geometricBounds[2] == _tempEPS_2.geometricBounds[2] && _tempEPS_1.geometricBounds[3] == _tempEPS_2.geometricBounds[3]) {

              return [false,""];

            } else {

              _tempEPS_1.clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;

              return [true,_tempEPS_1.clippingPath.appliedPathName];




          function __placeFile (_file,_layer) { 

            var _filePath = _file.itemLink.filePath;

            var _fileToPlace = File(_filePath);

            return app.activeDocument.pages[0].place(_fileToPlace,[0,0],_layer,false)[0];  




          A little roundabout, i know, but i think you can not obtain the value in a direct way. But maybe someone else knows a better way.



          • 2. Re: Detecting clipping path in EPS file
            Muppet Mark Level 5

            If the *.eps was created by photoshop then look to read the file. Search the photoshop scripting forum you can look for 'oclip' or the photoshop file spec tag.