Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Indesign Image location

Community Beginner ,
Oct 10, 2013 Oct 10, 2013

Hi,

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

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 10, 2013 Oct 10, 2013

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?

@+

Marc

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2013 Oct 13, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 14, 2013 Oct 14, 2013

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):

getGraphicsCoordinates();

// 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;

        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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 14, 2013 Oct 14, 2013
LATEST

Ok Great thanks,

We'll give it a go.

Thanks for the help.

Fionn O'Toole

Graphic Design

[cid:FEC02B21-179C-46D3-BFAD-5360B6AF21FA][cid:ADBE5DFC-33C3-43A2-BFB4-0E89A7300DCE]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines