[Image-SIG] Correctly determine image size of a Photoshop EPS

Stefano Masini stefano at pragma2000.com
Mon Sep 19 20:09:37 CEST 2005


Hello,

I got hold of some EPS files evidently made with Photoshop.
It seems I can't convert them to jpeg while retaining the correct
size. The problem is that I need to know the original size because I
have to make decisions depending on that.

I've got one that when opened in Photoshop is 1315x890, but anything
else gives me a 316x214 image. I tried with pil, imagemagick, exiftool
and freeimage. I think all of them except exiftool rely on
ghostscript.

I figured the problem must be the BoundingBox being set to 0 0 316 214.

This is extracted from the eps file:

%%Creator: Adobe Photoshop Version 7.0
%%Title: 102251N_c.eps
%%CreationDate: Fri Sep 16 2005 18:31:35
%%BoundingBox: 0 0 316 214
%%HiResBoundingBox: 0 0 315.6 213.6
%%SuppressDotGainCompensation
%%DocumentProcessColors: Cyan Magenta Yellow Black
%%EndComments
%%BeginProlog
%%EndProlog
%%BeginSetup
%%EndSetup
%ImageData: 1315 890 8 4 0 1 6 "beginimage"
%BeginPhotoshop: 6362

So, first question: why is the BoundingBox set this way? Is it plain
wrong, or is there a rationale behind?

Then I see the non standard %ImageData field. I found the following
info bout it:

Photoshop 6.0 SDK
EPS Parameters for ImageData (Photoshop 3.0 and later)

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 stored in the file.
             Ignored when reading...
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/ascii 1 = Data is in binary format
             2 = Data is in hex ascii format
data start   Entire PostScriptline immediately preceding the image data.
             This entire line should not occur elewhere in the PostScript
             header code, but it may occur at part of line   

So, since this is documented, why is it not implemented in any tool?
I guess I can answer that: because it's not standard and could change
without notice.

But then I wonder: isn't there any support at all? How can a poor soul
know the size of a photoshop eps file without opening it with
photoshop?

I can't believe others didn't have this problem. Did everybody have to
implement their own dirty parser and search for the %ImageData field
by themselves?

Please help a poor soul,
thanks!
stefano


More information about the Image-SIG mailing list