Skip navigation
Currently Being Moderated

How do I generate a report showing exact image sizes?

Apr 11, 2012 7:33 AM

Tags: #image_size #report

I was directed here from the general InDesign forum.

 

My publisher uses InDesign for creating books. I do not own the product, as I can't justify the cost at this time.

 

I provided the photography for this book, and I need to accurately determine the image sizes that he used, so that I can use Photoshop to edit them to look best at the sizes used in the publication.

 

Is there a report that he can generate from InDesign, which will give me the image names along with the final image dimensions? I'd rather not go to his office and write all this down manually, as there are hundreds of photos I need to process.

 

I am hoping that perhaps someone has already written a script that can do this, or knows of a free tool that can help me out.

 
Replies
  • Currently Being Moderated
    Apr 12, 2012 1:46 AM   in reply to msabeln

    Well, since no-one else reacted let me have a go at it ...

     

    Here is a Javascript that lets you save a report for all used image file names and the size of the rectangle it is placed in (note that it is possible this is not the "image size used"!).

     

    //DESCRIPTION:Write image size report
    // A Jongware Script 12-Apr-2012
    res = [];
    imgs = app.activeDocument.allGraphics;
    unitname = getCurrentUnit();
    for (i=0; i<imgs.length; i++)
    {
      h = imgs[i].parent.geometricBounds[2] - imgs[i].parent.geometricBounds[0];
      w = imgs[i].parent.geometricBounds[3] - imgs[i].parent.geometricBounds[1];
      // some fair rounding
      switch (unitname)
      {
        case 'in': w = w.toFixed(3); h = h.toFixed(3); break;
        case 'cm': w = w.toFixed(2); h = h.toFixed(2); break;
        default: w = w.toFixed(1); h = h.toFixed(1);
      }
      res.push (imgs[i].itemLink.name+'\t'+w+' x '+h+' '+unitname);
    }
    defaultFile = new File (Folder.myDocuments+"/"+app.activeDocument.name.replace(/\.indd$/i, '')+".txt");
    if (File.fs == "Windows")
      writeFile = defaultFile.saveDlg( 'Save report', "Plain text file:*.txt;All files:*.*" );
    else
      writeFile = defaultFile.saveDlg( 'Save report');
    if (writeFile != null)
    {
      if (writeFile.open("w"))
      {
        writeFile.encoding = "utf8";
        writeFile.write (res.join("\r")+"\r");
        writeFile.close();
      }
    }
    function getCurrentUnit ()
    {
      switch (app.activeDocument.viewPreferences.horizontalMeasurementUnits)
      {
        case MeasurementUnits.POINTS: return "pt";
        case MeasurementUnits.PICAS: return "pt";
        case MeasurementUnits.INCHES: return "in";
        case MeasurementUnits.INCHES_DECIMAL: return "in";
        case MeasurementUnits.MILLIMETERS: return "mm";
        case MeasurementUnits.CENTIMETERS: return "cm";
        case MeasurementUnits.CICEROS: return "c";
        case MeasurementUnits.AGATES: return "ag";
        default: alert ("Oh, come on!"); exit(0);
      }
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Incoming Links

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points