How to check the raster image resolution in illustrator through script?
Thanks for your reply.
I have found another script which returns the dpi of linked images.
I am not so good in scripting could you have a look in this and convert to RasterItem.resolution.
var docRef = activeDocument;
with (docRef) {
// We are expecting 1 placed item (image) here!!!
var placedWidth = placedItems[0].width;
var placedHeight = placedItems[0].height;
var placedPath = placedItems[0].file;
// The 2 variables below are global
XpixelDimension = 0;
YpixelDimension = 0;
// Call the function
exifDimensions(placedPath);
// Calculate the Height & Width DPI's
var widthDPI = Math.floor(XpixelDimension / (placedWidth / 72));
var heightDPI = Math.floor(YpixelDimension / (placedHeight / 72));
alert('Width DPI is ' + widthDPI + ' Height DPI is ' + heightDPI);
}
function exifDimensions(imageFilePath) {
imageFilePath.open('r');
try {
while (imageFilePath.tell() < imageFilePath.length) {
var line = imageFilePath.readln();
var idxOf = (line.indexOf('<exif:PixelXDimension>') > -1) ? line.indexOf('<exif:PixelXDimension>') : line.indexOf('<exif:PixelYDimension>');
if(idxOf > -1) {
if(line.indexOf('<exif:PixelXDimension>') > -1) XpixelDimension = parseInt(line.substring(line.indexOf(">")+1, line.lastIndexOf("<")));
else YpixelDimension = parseInt(line.substring(line.indexOf(">")+1, line.lastIndexOf("<")));
}
}
}
catch (ex) { alert('Fluff');}
finally { imageFilePath.close(); return [XpixelDimension, YpixelDimension]; }
}
Thanks in advance
Vinoth
Oh… I care not for that fluff you keep your title… I've got ++ in a tax free offshore account that adobe don't knon how to fix…
Jong showed me how he has thousands tucked away… Any hows well done on the promotion… You defo get invite to xmas party now MVP guest speaker… ( Carlos book him )
Muppet Mark wrote:
Oh… I care not for that fluff you keep your title… I've got ++ in a tax free offshore account that adobe don't knon how to fix…
Jong showed me how he has thousands tucked away… Any hows well done on the promotion… You defo get invite to xmas party now MVP guest speaker… ( Carlos book him )
hahaha...you're definitely invited to the xmas party Larry, we'll be honored to have an MVP as guest of honor...congrats by the way.
No need to be surprised.
You are only seeing the positive merits, the "plus" side of it. Unbeknownst to you, me, and the other forum members, there may be a minus list as well. If one gets added (subtracted perhaps) for every inappropriate remark, bad joke, condescending answer, jab to Adobe in general / Adobe staff / Adobe programmers / Adobe support / Adobe corporate desicion, actual complaint, or bashing down on this infernal Jive editor, well, I'm pretty sure my minuses would stick out of the left side of your screen. ... into the next room, perhaps.
If one gets added (subtracted perhaps) for every inappropriate remark, bad joke, condescending answer, jab to Adobe in general / Adobe staff / Adobe programmers / Adobe support / Adobe corporate desicion, actual complaint, or bashing down on this infernal Jive editor, well, I'm pretty sure my minuses would stick out of the left side of your screen. ... into the next room, perhaps.
mmm...you're being punished Jong, if that was true then I have to start behaving to someday get to be an mvp hahaha....I was wondering why some of the top contributors in the regular AI forum didn't get the MVP badge, then I checked and Steve, Scott F, mike and James are under the 5,000 points (not that it is required i guess, there are a couple mvp's with around 2,000 points)...interesting that the top two, Wade and Jacob didn't get it either....I wonder if some of them declined....
North America
Europe, Middle East and Africa
Asia Pacific