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
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
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
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).");
}
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
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
myimage
}
alert("Images have been fitted (center content and fit content to frame).");
}
Copy link to clipboard
Copied
How to make an image scale equally by width to fit the width of a column