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

Resize image to fit frame

Contributor ,
Dec 05, 2018 Dec 05, 2018

Copy link to clipboard

Copied

Hi,

I want to resize the image and fit into the overflow/overset frames using indesign script

and how resize the image into frame size then fit?

pls help

TOPICS
Scripting

Views

2.2K

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
Community Expert ,
Dec 05, 2018 Dec 05, 2018

Copy link to clipboard

Copied

Do you mean to say that your document has frames that has text and images in it and some of them have overset. So you need a code to find frames with overset and if there is any image in it then resize the image to remove the overset? What is the logic you would want to resize the image?

Please elaborate on the issue

-Manan

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
Community Expert ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Search the forum.

I think, we already had this question some months ago and it was answered sufficiently.

Regards,
Uwe

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
Explorer ,
Aug 09, 2019 Aug 09, 2019

Copy link to clipboard

Copied

This is what I used (JSX Script)

fitImagesToFrame(); 

 

function fitImagesToFrame(){ 

    var allLinks = app.activeDocument.links; 

    for(var i=0;i<allLinks.length;i++){ 

           var myImage = app.activeDocument.links.parent;

           myImage.fit(FitOptions.FILL_PROPORTIONALLY);  // fill frame proportionally

           //myImage.fit(FitOptions.PROPORTIONALLY); // fit frame proportionally

    }

    alert("Images have been fitted (Fill Proportionally).");

}

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
Community Expert ,
Aug 10, 2019 Aug 10, 2019

Copy link to clipboard

Copied

Hi heatherw6960836 ,

hm. Perhaps it would be better to work with the document.allGraphics array.

There could be text files linked as well. And it could be that some graphics are not linked at all.

FWIW: I'm not clear at all what the OP exactly wants:

…and how resize the image into frame size then fit?

That would require a text frame where the anchored image is resized to fit the width ( ? ) of the frame.

I'm not sure about that. If the anchored image is in overset there is no frame to fit the width or height.

It's also unclear if then the anchored image in overset should fit the last text frame of the story.

Whether in width, in height or both is also unclear.

So a first step could be to clear overset by either expanding the last text frame of the story or do a new text frame and thread it to the last frame of the story. However, if the cause of the overset is the anchored image I would suggest to "move" it out of the frame either by using a different anchoring method or by moving it to a new insertion point of a frame that is big enough to hold it.

Then it could be resized and later be tested if the story where it was positioned in will still go to overset if it is anchored the same way than before.

Complex cases.

Unfortunately we have no details 😉

The OP never came back. 😞

Regards,
Uwe

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
Explorer ,
Aug 12, 2019 Aug 12, 2019

Copy link to clipboard

Copied

Hi again!

Yes, better to do "allGraphics" as I'm learning more and more about InDesign scripting. Thanks!

Here is a revised script I used.....

/*

This script is looping through all images and then trying to fit conent.

*/

fitImagesToFrame(); 

 

function fitImagesToFrame(){ 

    var myDoc = app.activeDocument;

    var myimage = myDoc.allGraphics;

    for (var g=0; myimage.length>g; g++){

        myimage.fit(FitOptions.CENTER_CONTENT);

        myimage.fit(FitOptions.CONTENT_TO_FRAME);

    }

    alert("Images have been fitted (center content and fit content to frame).");

}

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
Advocate ,
Nov 17, 2024 Nov 17, 2024

Copy link to clipboard

Copied

LATEST

How to make an image scale equally by width to fit the width of a column

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