Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi
you should set `mySel.clippingPath.threshold` greater than 0 (1...255)
thank you
mg
Copy link to clipboard
Copied
Thanks for the feedback, but that doesn't seem to do the trick. I think threshold and tolerance only affect the image color/quality, but not the actually path. Even when using the menus, I don't fully understand the process, since the convert to frame option doesn't reliably cut the image along the edges of the frame, in my recent test doc, it didn't even do anything. Strange...
For what it's worth, I solved my problem with another method: I exported the rectangle and its content as a high quality jpg and immediately placed it back into the frame, replacing the big image at the same time. Worked fine.