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

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

Participant ,
Feb 25, 2017 Feb 25, 2017

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

TOPICS
Scripting

Views

466

Translate

Translate

Report

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 ,
Feb 26, 2017 Feb 26, 2017

Copy link to clipboard

Copied

Hi

you should set `mySel.clippingPath.threshold` greater than 0 (1...255)

thank you

mg

Votes

Translate

Translate

Report

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
Participant ,
Feb 28, 2017 Feb 28, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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