2 Replies Latest reply on Feb 28, 2017 7:22 AM by AnotherFrank

    How to crop an image using clippingPath.convertToFrame()?

    AnotherFrank

      Hi,

       

      Something which seems rather simple is a miracle to me. I've been trying to crop images at the edges of the graphic frame containing the image (to reduce the file size of the INDD). The immediate option would be to convert the clipping path and use the restrictToFrame option, but it doesn't work. As a side note, using the menus, I can select the graphic frame, but with scripting, I have to address the image. Ok, this should still work:

       

      var mySel = app.activeDocument.selection[0].images[0];
      
      with (mySel.clippingPath) {
        clippingType = ClippingPathType.DETECT_EDGES;
        includeInsideEdges = false;
        restrictToFrame = true;
        useHighResolutionImage = true;
        threshold = 0;
        tolerance = 0;
      }
      mySel.clippingPath.convertToFrame();
      

       

      but it doesn't. I don't get an error but the image isn't cropped to the bounding box of the graphic frame, it's appears to be unchanged.

       

      Can someone help please?

       

      Thanks