Skip to main content
dublove
Legend
August 17, 2025
Question

When scaling an image to a specific size, are there two different approaches?

  • August 17, 2025
  • 1 reply
  • 120 views

You need to set different object styles:

You need to decide whether to enlarge or reduce the size and choose the appropriate option.
For example, I want to reduce all images to 60 mm.
This is too tedious. Is there a simpler way?

 

This seems like a foolish plan:

        if (imw <= 60) {
            w.frameFittingOptions.fittingOnEmptyFrame = FitOptions.FILL_PROPORTIONALLY;
        }
        if (imw > 60) {
            w.frameFittingOptions.fittingOnEmptyFrame = FitOptions.PROPORTIONALLY;
        }

. . .
. . .
    sel.fit(FitOptions.FRAME_TO_CONTENT);

 

1 reply

Community Expert
August 18, 2025

Hi @dublove ,

you'll need no if statements if you want to do it for all your graphics.

Simply loop the document's allGraphics array and apply your code to every parent of a graphic.

 

FWIW: Of course you have to calculate the width of a graphic frame if the frame is rotated or if the graphic is anchored if the text frame that holds the graphic is rotated.

 

If you can calculate a scaling factor see into the following thread, especially my reply here that is using method transform() on the graphic frame:

 

[AS/CC]Resizing a box and its contained image
Laubender, Feb 08, 2014

https://community.adobe.com/t5/indesign-discussions/as-cc-resizing-a-box-and-its-contained-image/m-p/5792748#M298806

 

Also look into:

Work Around the Width/Height Gap
Marc Autret, October 17, 2009

https://indiscripts.com/post/2009/10/work-around-the-width-height-gap

 

Regards,
Uwe Laubender
( Adobe Community Expert )