Skip to main content
Known Participant
June 1, 2010
Answered

Indesign fitting image after placing

  • June 1, 2010
  • 1 reply
  • 4246 views

I've gotten pretty far with using frame fitting options on image frames that are "loose" on a layout. But for image frames that are anchored in text is where I am failing, though Indesign does not present an error.

I start with a document with some text. And I anchor a labeled image frame into a certain point in the text.

I can place the image, but scaling and the frame fitting options just don't do anything that I can tell.

set imgValue to "Assets:Signatures:AC_Vierra_sig1.tif"

tell application "Adobe InDesign CS4"

     tell document 1

          set allRect to (every rectangle of every story whose label is "CS46Signature")

          if (count of allRect) > 0 then

               repeat with thisRect in allRect

                    tell thisRect

                         set fitting alignment of frame fitting options to bottom left anchor

                         place imgValue

                         redefine scaling to {1.0, 1.0}

                    end tell --ax

               end repeat --drill down into img frames in text

          end if --allRect not empty

     end tell --theDoc

end tell --app

I've tried different combinations of these and they fail without error. What would you do given anchored image frames? thanx, sam

This topic has been closed for replies.
Correct answer sstanleyau

Thanks for sticking with me, Shane.

It failed again, but I looked at your snippet again to see if I missed anything. The only difference that I thought was cosmetic was that you put thePic variable in {}. But apparently, it isn't cosmetic. When i placed braces around my variable it worked.

I'm unaware of why that is?, sam


The place command returns a list (of one item). By using brackets, the variable contains the item from the list.

1 reply

Inspiring
June 1, 2010

Can you explain what you are actually trying to do to the image?

Known Participant
June 1, 2010

Yes, Shane.

I want to bring the image in, anchor it in the bottom left corner, and force it to 100% scaling.

Right now it comes in top left alignment and at 39 percent. I've not been able to figure out why Indesign scales images, but perhaps the dimensions of the image are larger than the box.

But I end up having to manually align and scale it to 100 percent. I want the script to do the job.

Thanks for looking at it, sam

Inspiring
June 2, 2010

You're getting scaling because presumably that's how your anchored item options are set up in the document. Meanwhile your simplest approach is probably to place the image, fit given content to frame, set the transform reference point of the layout window to bottom left, then set horizontal and vertical scale to 100%.