3 Replies Latest reply on Feb 26, 2008 7:23 AM by (jeanpaul)

    Export Image Coordinates for use in DB

      Hello

      I currently have an ID document holding 1,000 images. The document was made using a DB-export (csv). The owner of the images has (manualy) scaled the images and positioned them to his needs. The problem is that when the book has to be re-done, all that data will be gone (as the DB does not hold any coordinates, yet). Is there a script to extract the imagename and it's coordinates/scaling? That would be enough to update the database so we can reuse the same data aover and over again.

      Hope this made sense!

      T.I.A.

      JP
        • 1. Re: Export Image Coordinates for use in DB
          Peter Kahrel Adobe Community Professional & MVP
          This script could take a while to run. If you use CS3 you could tart it up with a progress bar or some other display to monitor the script's progress.

          Peter

          // Create a text file in the user's folder
          // and store some data of each graphic:
          // file name, coordinates, vertical-horiz. scaling, e.g.
          // example.jpg 10,15,300,500 100,100
          // The three items are separated by tabs.

          f = new File ('~/coordinates.txt');
          f.open ('w');

          g = app.activeDocument.allGraphics;
          for (i = 0; i < g.length; i++)
          {
          data = File(g[i].itemLink.filePath).name + '\t';
          data += g[i].itemLink.parent.geometricBounds + '\t';
          data += g[i].itemLink.parent.absoluteVerticalScale + ',';
          data += g[i].itemLink.parent.absoluteHorizontalScale;
          f.writeln (data)
          }

          f.close();
          • 2. Re: Export Image Coordinates for use in DB
            Level 1
            Peter,

            Thanks a million, this does exactly what I hoped for.

            Super!!

            JP
            • 3. Re: Export Image Coordinates for use in DB
              Level 1
              Hmm that didn't produce the result I needed afterall. I didn't get the image offset, only the coordinates of the picturebox.

              I've added:

              ...
              data += g[i].parent.geometricBounds;
              ...

              The difference between that result and

              ...
              data += g[i].itemLink.parent.geometricBounds + '\t';
              ...

              is the actual image offset.