4

ImageMagick reports the following size for this file:

03072004.TIF EPT 1251x403=>1252x401 1252x401+0+0 16-bit ColorSeparation DirectClass 2.008MB 0.000u 0:00.000

I cannot figure out how the dimension 1252x401 is calculated. I assumed that the bounding box defines the dimensions of the image (because it is one of the few mandatory meta data attributes). However this is clearly not the case. So what is the exact meaning of those values? And how to calculate the width and height?

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: Adobe Photoshop Version 4.0.1
%%Title: 03072004.TIF
%%CreationDate: 16.04.1999 12:18 Uhr
%%BoundingBox: 0 0 287 92
%%HiResBoundingBox: 0 0 286.8535 92.4076
%%SuppressDotGainCompensation
%%DocumentProcessColors: Cyan Magenta Yellow Black
%%EndComments
%%BeginProlog
%%EndProlog
%%BeginSetup
%%EndSetup
%ImageData: 1251 403 8 4 1 1251 1 "beginimage"
%BeginPhotoshop: 5828
%3842494D040400000000001B1C0200000200021C0278000F303330373230300D

Note however, that some of my sample files the %%BoundingBox defined the dimensions as reported by ImageMagick (and other tools).

rmuller
  • 12,062
  • 4
  • 64
  • 92

1 Answers1

4

Any line beginning with '%' in PostScript (EPS = Encapsulated PostScript) is a comment, so it has no meaning in the language.

EPS files are PostScript files prepared to conform to the EPS specification, which stores extra data in the comments. PostScript interpreters ignore them, EPS parsers use them for specific purposes.

EPS consumers treat the contents of an EPS as a 'black box' which they can inject verbatim (with some conditions) into a PostScript program in order to make some marks on a page. This could be a logo for example.

Usually an EPS consumer is a page layout application, printing to a PostScript program to be sent to a PostScript printer. In this case its critically important for the layout application to know what the bounding box of the EPS is. This allows it to set up the co-ordinate system to scale the EPS contents appropriately to fit into the space allocated on the output medium.

You can find the EPS specification on the Adobe web site somewhere, and if you plan on dealing with EPS file you should probably download and read it.

The BoundingBox comments give the size of the EPS in PostScript unts (1/72 inch).

Note that EPS cannot contain a TIFF image, but your EPS file contains a Photoshop preview (also in the comments), I suspect that ImageMagick is using that in some fashion. Try deleting it and see what happens.

Everything from %ImageData: that begins with a '%'

KenS
  • 30,202
  • 3
  • 34
  • 51
  • So does this means the pixel width and height cannot be retrieved from the meta data / comments? Also: what is the difference bewteen the comments starting with '%' and with '%%' ? – rmuller Aug 24 '15 at 14:58
  • 1
    In general an EPS file is PostScript, which is usually (though not exclusively) a **vector** page description. As such there is no 'pixel' width and height. The width and height are given in PostScript units, which are 1/72 inch. Multiply by the resolution you render at to find the width and height of the resulting bitmap. Any line beginning '%' is a comment, the Document Structuring Convention says that DSC comments (which includes EPS comments) begin '%%' – KenS Aug 24 '15 at 16:12
  • This makes sense. Still struggling with the output of ImageMagick `identitfy`. It reports an width and height. If I understand your comment correctly, this is just impossible?! – rmuller Aug 24 '15 at 17:05
  • From the EPS comments, yes, but.... As I also said, there's a bunch of other comments in there which are not strictly EPS comments, specifically there's a Photoshop preview which contains the arguments passed to the 'image' operator (PostScript, as you might expect, can include bitmap data, it just doesn't have to). Its possible that ImageMagick is using that in some sense. I don't know enough about ImageMagick to help you there, all I can do is answer your question about the PostScript comments. Note that the EPS comments *do* include a width and height, it just isn't in pixels. – KenS Aug 25 '15 at 07:01