The format of Photoshop EPS files is partially documented here:
http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035096
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>"
<columns>: Width of the image in pixels.
<rows>: Height of the image in pixels.
<depth>: Number of bits per channel. Must be 1 or 8.
<mode>: Image mode. Bitmap/grayscale = 1; Lab = 2; RGB = 3; CMYK = 4.
<pad channels>: Number of other channels store in the file. Ignored when reading. Photoshop uses this to include a grayscale image that is printed on non-color PostScript printers.
<block size>:Number of bytes per row per channel. Will be either 1 or formula (below):
1 = Data is interleaved.
(columns*depth+7)/8 = Data is stored in line-interleaved format, or there is only one channel.
<binary/hex>:
1 = Data is in binary format.
2 = Data is in hex ascii format.
<data start>: Entire PostScript line immediately preceding the image data. This entire line should not occur elsewhere in the PostScript header code, but it may occur at part of a line.
Besides, some information about other values of <binary/hex> can be found here:
http://python.6.x6.nabble.com/Correctly-determine-image-size-of-a-Photoshop-EPS-td2096786.html
1 - binary
2 - ascii
3 - jpeg low quality
4 - jpeg medium quality
5 - jpeg high quality
6 - jpeg maximum quality
7 - ascii85
Here is a test script using this information:
function main ()
{
function isPhotoshopEPSFile (f)
{
return (f.type === 'EPSF') || f.name.match (/\.eps$/i);
}
var epsFilter =
(File.fs === "Macintosh") ?
function (f) { return (f instanceof Folder) || isPhotoshopEPSFile (f) } :
"Photoshop EPS Files:*.eps,All Files:*.*";
var epsFile = File.openDialog ("Open Photoshop EPS file:", epsFilter);
if (epsFile)
{
if (epsFile.open ("r"))
{
while (!epsFile.eof)
{
var line = epsFile.readln ();
var found = line.match (/^%ImageData:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/);
if (found)
{
var dataFormatIndex = found[7];
var dataFormats =
[
"Binary",
"ASCII",
"JPEG (low quality)",
"JPEG (medium quality)",
"JPEG (high quality)",
"JPEG (maximum quality)",
"ASCII85"
];
alert (dataFormats[dataFormatIndex - 1]);
break;
}
}
epsFile.close ();
}
}
}
main ();
HTH,
--Mikaeru
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

