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

Fredrik Lundh fredrik at pythonware.com
Tue Sep 20 08:19:47 CEST 2005


Stefano Masini wrote:

> 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?

as Kevin says, it's probably because the image is saved with a specific DPI
(the bounding box is in points, so it's only the same thing as the number of
pixels for images where the DPI is set to 72)

> 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?

PIL is supposed to support ImageData tags, and it should pick the size from
the ImageData header over the bounding box, but I suppose it's not robust
enough to handle your file.

if you can mail me a copy of the file (off-list), I can take a look when I find
the time.

</F>





More information about the Image-SIG mailing list