1 Reply Latest reply on May 5, 2009 1:23 AM by Kasyan Servetsky

    Get bounds of image in relation to the frame VB CS4

    Dave Pepper

      Does anyone know the properties I would use to capture how an image has been moved in relation to it's frame?  I have images that have been shifted within the frame, and I need to capture the x, y offset in relation to the parent frame.

        • 1. Re: Get bounds of image in relation to the frame VB CS4
          Kasyan Servetsky Level 5

          I would calculate the difference between geometric bound of the  image and its parent frame – X1 and Y1 points. Here is an example in JS, to show you my idea, but the same can be done in VB of course.

           

          myDoc = app.activeDocument;
          rec = myDoc.pages[0].rectangles[0];
          img = rec.images[0];
          r_gb = rec.geometricBounds;
          i_gb = img.geometricBounds;
          if (    Math.round(r_gb[0]) == Math.round(i_gb[0]) &&
                  Math.round(r_gb[1]) == Math.round(i_gb[1]) ) {
              alert("Not shifted.");
          }
          else {
              alert("Shifted:\rX: " + (Math.round(i_gb[1]) - Math.round(r_gb[1])) + "\rY: " +  (Math.round(i_gb[0]) - Math.round(r_gb[0])));
          }