Skip to main content
Known Participant
October 26, 2024
Answered

Resize height and width of multiple sized objects by adding the same measurement to each object

  • October 26, 2024
  • 2 replies
  • 4238 views

Dear Community,

 

I'm hoping there's a solution to this one within Indesign. I have multiple different sized rectangle picture boxes (objects) on a page and need to resize them all at the same time by adding 6 mm to the height and 6 mm to the width of each.

 

Essentially I have a page of many picture boxes of different sizes which I can add crop marks via the script, offset 3 mm from the object. I then need to add 3 mm around all images. And then I can fit content to frame all at the same time. This will then quickly give me images on the page with crop marks and bleed for multiple sized objects on a page ready for printing on large boards, and then images are trimmed down from the one sheet. I'm trying to avoid manually adding the 3 mm to each of the different sized boxes which I have about 150 images.

 

Regards

Simon

Correct answer Robert at ID-Tasker

thanks for the suggestion. I selected 2 frames (filled boxes, no lines) using Shift. But unfortunately still the same result, only 1 frame resizes. It's a bit of a mystery. screenshot attached. thanks so much for your time and expertise.


OK. 

 

You've copied code in the middle of me posting it - I've made a mistake so I've edited it a minute later 🙂 

 

Please REMOVE "[a]" in the "fit" line - it should be: 

 

myObj.fit(FitOptions.FILL_PROPORTIONALLY);

 

2 replies

Participant
August 11, 2025

I can totally relate, I was facing a similar headache on my own website (https://heightcomparisonchart.com/) where I have to resize multiple elements consistently without manually adjusting each one. The easiest method I’ve used is to select all the frames I want to resize. Then goes to Object → Transform → Transform Each. In the dialog, I checked Relative and added +6 mm to both Width and Height fields.

Robert at ID-Tasker
Legend
October 26, 2024

If you work on a PC, I can give you access to the full version of my ID-Tasker tool for a few days. 

 

If you need scripting solution anyway - you need to give more info - from which corner the resizing should be performed - or from the center? 

 

Known Participant
October 26, 2024

I work on a Mac I'm afraid.

 

Resizing from the centre outward for each frame selected. So if I select 100 frames that are all different sizes I'm hoping I can expand each of their sizes by 3 mm each side from the centre. example a 200 x 300 mm frame would end up being 206 x 306 mm, a 400 x 425 mm frame would become 406 x 431 mm etc. Each frame will have a different image in the frame before I apply the 3 mm resize script. 

Robert at ID-Tasker
Legend
October 26, 2024

There is no error handling - I'm not very good in JS - but as long as you select some objects and set values - you should be fine 😉

 

var myResizeX = 3;
var myResizeY = 3;

var myObj;

var mySel = app.selection;

for (var a=0;a<mySel.length;a++)
{
  myObj = mySel[a];
  myObj.geometricBounds = [ myObj.geometricBounds[0]-myResizeY, myObj.geometricBounds[1]-myResizeX, myObj.geometricBounds[2]+myResizeY, myObj.geometricBounds[3]+myResizeX];
  myObj.fit(FitOptions.FILL_PROPORTIONALLY);
};

 

myResizeX and myResizeY - you should enter HALF of what you want the objects to be resized by.

So if you need "6" - you need to enter "3" - as above.

 

Also, script "uses" your current measurement units. So if you work in "mm" - it will add "3 mm" to all sides. If you work in "inch" - it will add "3 in", and so on.

 

It also fills content in frame:

 

myObj.fit(FitOptions.FILL_PROPORTIONALLY);

 

You can find all possible options here:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#FitOptions.html

 

Just in case:

https://creativepro.com/how-to-install-scripts-in-indesign/

https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post/