How to check the raster image resolution in illustrator through script?
since you've ask a number of times I figure is kind of important for you. You've noticed you didn't get an answer, there's no navtive Resolution property in Illustrator....but there's hope, one way I think you can accoplish that is by using BridgeTalk to open the Illustrator file in photoshop....PS can easily get you the resolution and send it back to Illustrator.
If this is as crucially important as the OP appears to think, taking the low road may help. Export to EPS and you got yourself an easily readable ASCII formatted text file that you can inspect at will.
By the way, as with all image formats that allow embedding one or *more* images into a single file, you cannot say anything about *every* embedded raster file at once -- you have to inspect each of them.
Hi Mark, I opened the Ai file manually in PS and I got the "Import PDF" dialog where I chose "images". That brings the chosen image at its native resolution...
...then I tried with VBA (very easy to get AI and PS to talk to each other) and it worked as expected...
let me try with BridgeTalk...hope there's no issues.
This seems to solve it: ![]()
// select a rasterItem, no rotation or skew
72/app.selection[0].matrix.mValueA;
// also
72/app.selection[0].matrix.mValueD;
// for rotation applied(no skew) item
var item = app.selection[0],
matrix = item.matrix,
rotation = 180/Math.PI * Math.atan2(matrix.mValueC, matrix.mValueD);
item.rotate(rotation);
alert(72/item.matrix.mValueA);
item.rotate(-rotation);
ok, here's the BridgeTalk version, it works with Linked or Embedded images...it was a good exercise, but I think Molouapple's version is more straightforward
var idoc = app.activeDocument;
var idocname = idoc.fullName;
//alert(idocname);
//$.writeln(idocname);
var bt = new BridgeTalk;
bt.target = "photoshop";
var msg = "\n" +
"var pdfOpts = new PDFOpenOptions;\n" +
"pdfOpts.page = 3;\n" +
"var file = new File('" +idocname+"');\n" +
"var idoc = app.open(file, pdfOpts);\n" +
"resolution = idoc.resolution;\n"
bt.body = msg;
bt.onResult = function(resObj) {
var res = resObj.body;
alert("Resolution = " + res);
}
bt.send();
North America
Europe, Middle East and Africa
Asia Pacific