4 Replies Latest reply on Aug 6, 2009 1:36 AM by Muppet Mark-QAl63s

    Display part of an image in a box

    MVarner

      I have a script that places several images in boxes using script labels.  I use the command, "fit myrect3 given content to frame" and that works great for all images but one.  One image is larger than the box and I only want to show a portion of the image.  Currently I move the image manually until I can only see the part of the image I want.  The image is always formatted the same so I wanted to know if there is a command to insert an image in a box with an offset so only part of the image shows?

        • 1. Re: Display part of an image in a box
          Dave Saunders Level 4

          There isn't a single command to do that, but you can certainly move the image after placing using the move method.

           

          Dave

          1 person found this helpful
          • 2. Re: Display part of an image in a box
            MVarner Level 1

            Thanks Dave.  Can you show me an example of the move command?

            • 3. Re: Display part of an image in a box
              MVarner Level 1

              I can use the move command to move the rectangle but I can't move it's content separately and leave the rectangle where it is..

              • 4. Re: Display part of an image in a box
                Muppet Mark-QAl63s Level 4

                Are you targeting the image object within the rectangle for the move command? Here are two examples one using the 'move' method the other by getting the 'bounds' and repositioning by changing those. If you get the bounds of the containing rectangle too then you should be able to use some math on how to fill & position within the rectangle.

                 

                set This_Image to choose file

                --

                tell application "Adobe InDesign CS2"

                tell active document

                tell page 1

                tell rectangle 1

                place This_Image

                move image 1 by {-10, -10}

                end tell

                end tell

                end tell

                end tell

                 

                *****************************************

                 

                set This_Image to choose file

                --

                tell application "Adobe InDesign CS2"

                tell active document

                tell page 1

                tell rectangle 1

                place This_Image

                set {Rect_T, Rect_L, Rect_B, Rect_R} to geometric bounds

                set {Pict_T, Pict_L, Pict_B, Pict_R} to geometric bounds of image 1

                set geometric bounds of image 1 to ¬

                {Pict_T - 10, Pict_L - 10, Pict_B - 10, Pict_R - 10}

                end tell

                end tell

                end tell

                end tell