Copy link to clipboard
Copied
Greeting all,
I've posted about getting image resolution before and have a script we've been using with great success but I just learned from my operator that the script never returns the resolution for Photoshop EPS bitmap files.
I'm using .Graphics(1)..ActualPpi(0) and most times works just fine except for the Photoshop EPS bitmap files. Photoship color EPS, gray EPS and a bitmap TIF saved from Photoshop works just fine. Everything except Photoshop EPS bitmap.
I've tried using .EPSs(1).ActualPpi but that yields the same result.
Is there somethnig I'm missing (again)?
Many thanks,
Ken
Copy link to clipboard
Copied
An EPS may have originated in Photoshop, but InDesign does not know that -- and doesn't care, either. Since EPSes are generally vector files (with, oh, perhaps a few bitmaps in there, each one with its own resolution), InDesign just doesn't bother. It cannot see there is only one image in there.
If you really, really need to know: of course this information is somewhere inside the image. The image size in points is in the line
%%BoundingBox: 0 0 287 266
-- 6th line, in the test file I made; "287" is the width in whole points, "266" is the height.
The image width and height in pixels are somewhere lower:
%ImageData: 479 444 8 3 1 479 7 "beginimage"
-- where the first two items 479 and 444 are the width and height, respectively.
I can imagine a javascript that first checks if it is a Photoshop EPS (line #2 usually holds the "Creator"), then scans the file for (a) the physical dimensions in points, (b) scans the file for the actual dimensions in pixels, then (c) multiplies (b) by 72.0 to get points-to-inches and divides this by (a) to get (d) the horizontal and vertical resolution.
Also note that such files will open using "Edit Original" with ... Illustrator! Perhaps CS5 will recognize Photoshop-only EPSes. If you want to make sure it does, post here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
Copy link to clipboard
Copied
There are special EPS conventions for raster graphics.
In an EPS parser that I wrote back in 2002, I still have a comment / partial quote:
ps6ffspecsv2.pdf:
Photoshop includes a comment in the EPS files it writes so that it
is able to read them back in again.
Third party programs that write pixel–based EPS files may want to
include this comment in their EPS files, so Photoshop can read their
files. The comment must follow immediately after the %% comment block
at the start of the file. The comment is:
%ImageData: <columns> <rows> <depth> <mode> <pad channels>
<block size> <binary/hex> "<data start>"
Copy link to clipboard
Copied
Hi guys,
I offer the following approach to solve the problem:
var myDoc = app.activeDocument;
var myAllGraphics = myDoc.allGraphics;
var myGraphic = myAllGraphics[0];
var myLink = myGraphic.itemLink;
var myLinkXmp = myLink.linkXmp;
var myCreator = myLink.linkXmp.creator;
if (myCreator.indexOf("Adobe Illustrator") != -1) {
alert("The first link was created in Illustrator");
}
else if (myCreator.indexOf("Adobe Photoshop") != -1) {
try {
var myXres = myGraphic.actualPpi[0];
var myYres = myGraphic.actualPpi[1];
}
catch(err) {
if (err == "Error: A value is not available for this type of image.") {
var myXres = myLinkXmp.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:XResolution");
var myYres = myLinkXmp.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:YResolution");
}
}
alert("Resolution of the first link:\nX: " + eval(myXres) + " ppi\nY: " + eval(myYres) + " ppi");
}
Kasyan
Copy link to clipboard
Copied
All these suggestions make sense and myself have written a routine in another scripting language that got the resolution of the Photoshop EPS image files.
Jongware's suggestion also makes perfect sense except that Photoshop grayscale AND color EPS files work just fine as I mention in the original post. That, to me, is the strangest part of it.
Ken
Find more inspiration, events, and resources on the new Adobe Community
Explore Now