AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1997.01.08 22:25 "libtiff to write EPS preview", by Chuck Packard
1997.01.09 07:36 "Re: libtiff to write EPS preview", by Karsten Spang
1997.01.09 16:16 "Re: libtiff to write EPS preview", by Phillip Crews
1997.01.09 17:26 "libtiff to write EPS preview -Reply", by dprab@GEIOHIO.COM
1997.01.10 16:28 "Re: libtiff to write EPS preview", by Niles Ritter
1997.01.11 02:04 "Re: libtiff to write EPS preview", by Phillip Crews
1997.01.15 16:44 "Re: libtiff to write EPS preview", by Helge Blischke

1997.01.10 16:28 "Re: libtiff to write EPS preview", by Niles Ritter

I've used the TIFF library successfully to write EPS with TIFF preview. First write out the 30 byte header leaving the TIFF position and size blank. Write out the EPS and close the file. Now open the file again with the TIFF library and start writing the TIFF at the end of the file. Record the start position and end position of the TIFF to fill into the 30 byte header. You might have to make some changes with the TIFF library and using the 'a' option when opening the file.

From the discussions I surmise that there is a practice to insert a TIFF preview inside an EPS file. I hope that this is well documented, as it makes me nervous, and sounds very fragile.

The problem is that TIFF is a *file* format, not a *stream* protocol, is not easily streamable, and the format is based on absolute file-offsets, not relative. Suppose I try to hack the libtiff library to append a TIFF file to the end of an EPS. What should it use for the offset to the first image directory: the absolute location in the EPS file, or the offset relative to the TIFF header? If you dont use the absolute location in the file, then passing the TIFF image directory to a naive TIFF file reader will fail when it seeks to the wrong location. On the other hand, if you use the absolute location then you will never be able to extract it from the EPS file, since the locations will all be wrong (and no one wants to reset all those StripOffset values, do they?).

Sounds bad in either case, although the header-relative approach seems like the "better" alternative. A minimally hacked libtiff file in "a" mode would probably generate absolute offsets, unfortunately, since it uses seeks to compute the locations of things.

Just out of curiosity, which approach is specified in EPS?

--Niles.