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

Detecting clipping path in EPS file

New Here ,
Sep 06, 2013 Sep 06, 2013

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.

Thanks!

Piotr

TOPICS
Scripting
2.3K
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
Contributor ,
Sep 07, 2013 Sep 07, 2013

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) {

  alert(e);

}

app.epsImportPreferences.epsFrames = _uerEPSFrames;

_tempLayer.remove();

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.

Roland

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
Guru ,
Sep 07, 2013 Sep 07, 2013
LATEST

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.

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