4 Replies Latest reply on Oct 14, 2013 2:19 PM by TheTurtle

    Indesign Image location




      A client of ours has requested the below.....we are stumped.

      What they want from us is a list, possibly in csv format, of the exact central x and y location of each image in the Indesign file.

      Is this even possible? Our developer rekons somebody may be able to write a script.


      Any help or reccomendations would be greatfully appriciated.

      Many thanks

        • 1. Re: Indesign Image location
          Marc Autret Level 4

          Hi TheTurtle,


          That's very possible—and most people here can provide a code.

          But a preliminary question in giving the (x,y) location of anything is, relative to which coordinate space?




          • 2. Re: Indesign Image location
            TheTurtle Level 1

            Thanks for the reply Marc.


            the x, y location is relative to the top left corner of each indesign page which is 0,0.

            How much would you charge to write a script for this?


            Many thanks

            • 3. Re: Indesign Image location
              Andreas Jansson Level 2

              Wouldn't you (or your developer) rather like to learn scripting... since you found your way here :-) ?


              Just looping through the pages of an open document, and gathering the coordinates of all graphics is not that hard to do, but you might want to build more functionality into it, like looping through all documents in a folder, or writing the results to a file (instead of copying it from the output window of ExtendScript Toolkit), or other things...


              I'll give you a pice of code that you might be able to start with, that puts together a string, line by line, with the page number and the values of the top left coordinates of the graphics (TAB separated, just change "\t" to to ";" if you want it as a csv):


              // Returns a semicolon separated string of page names and graphics coordinates
              function getGraphicsCoordinates(){
                  var ln = '';
                  // loop through all pages in the current document
                  var pgLength = app.activeDocument.pages.count();
                  for (var i = 0; i < pgLength; i++){
                      var pg = app.activeDocument.pages[i];
                      pagePart = pg.name + '\t'; // Get the page name (or number) to the string.
                      // Loop through all graphics in the current page
                      var gr = pg.allGraphics;    
                      for (var j = 0; j < gr.length; j++){
                          var geo = gr[0].geometricBounds;
                          ln += pagePart;
                          ln += geo[0].toString() + '\t'; // The top coordinate is stored in geometricBounds 0
                          ln += geo[1].toString() + '\n'; // The left coordinate is stored in geometricBounds 0
                  return ln;
              • 4. Re: Indesign Image location
                TheTurtle Level 1

                Ok Great thanks,

                We'll give it a go.

                Thanks for the help.



                Fionn O'Toole

                Graphic Design