Home > InDesign Scripts > Find embedded images

Find embedded images

This is not my script, but I find it really handy! It searches through all links in document and finds just embedded links and push them into Array.

var doc = app.activeDocument;
var graphics = doc.allGraphics;
var embeddedGraphics = [];
for (var i = 0; i < graphics.length; i++) {
     if (graphics[i].itemLink.status == LinkStatus.LINK_EMBEDDED) {
          embeddedGraphics.push(graphics[i]);
     }
}
alert(embeddedGraphics.length + " embedded images were found");

When you have links in embeddedGraphics you can for example extract page number from link like this:

alert(embeddedGraphics[0].parent.parent.name);

Or link name:

alert(embeddedGraphics[0].itemLink.name);

Or effective ppi:

alert(embeddedGraphics[0].effectivePpi);

I want to credit Kasyan Servetsky as author of this short snippet.  This was also published on Adobe’s InDesign Scripting forum.

About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 36 other followers

%d bloggers like this: