1997sep07 Dan Ellis <email@example.com>
In the course of preparing a series of book chapters in Microsoft Word on the Macintosh, I found out about Macintosh-style EPSI preview images, and developed some tools for adding them to arbitrary postscript files. While the tools are barely acceptable, I've actually found them quite valuable. This note serves to summarize what I learned, and to describe the tools and their use.
Since converting the commands in a postscript file into an image is a complex and compute-intensive task, most document-processing programs cannot perform it, and if you place a postscript file in to a document with a program like Microsoft Word or Adobe Pagemaker, it will be displayed on-screen as a dummy outline. However, a compromise solution exists in the form of EPSI files, which are regulare encapsulated postscript images to which a small, low-resolution 'preview' has been attached in a simple, rasterized form more easily accessible to word processors. The intention is that documents containing EPSI images will use the preview to allow arranging the images on-screen, but then use the full postscript when sending the document to the printer, for maximum-quality final output.
It turns out that there are two quite different formats for adding previews to postscript images to create EPSI files. One, supported on Unix machines and presumably PCs, inserts the preview as a block of postscript comments at the head of the file. The other is Mac-specific and stores the preview as a Mac-format "PICT" image in the resource fork of the file (a concept limited to the Mac filing system), leaving the original postscript data unchanged.
There exists a very good tool, "ps2epsi", which uses the Gnu postscript interpreter "Ghostscript" to convert regular postscript to Unix-format EPSI. Unfortunately, most Macintosh applications don't use these kinds of previews (FrameMaker is an exception; Word appears to detect that the preview is present, but hasn't managed to actually display them for me). I looked pretty hard, but I couldn't find any free packages to produce the previews for the Macintosh.
So I wrote my own. It's ugly and awkward because it comes in two pieces, one running on a Unix workstation, and the other on a Macintosh. The Unix piece, "ps2pict", takes a postscript image and uses Ghostscript plus the pbmplus graphic utilities to produce a Mac PICT file that will serve as the preview. But in order to store this in the correct place on a file, I had to write a little Mac application "toepsi" that pastes PICT files into the appropriate place in the resource fork of PostScript files.
Transferring the PICT files from the Unix machine to the Mac is also a little tricky, because the Mac has to know to treat them as PICTs. Since I have a CAP/AUFS (Columbia Appletalk Package/Apple Unix File System) server that allows my Mac to see Unix disks as regular Mac volumes, I was able to fake up the .finderinfo files to mark the PICTs generated on the Unix side as such when seen by the Mac. Using a different method to transfer the PICTs to the mac might require some other solution to this part.
(Of course, since AUFS actually provides access to the resource fork within the Unix file system (via the ".resource" subdirectories), I could in theory have done the PICT-pasting on the Unix side too. However, writing a general interpreter for the rather involved resource fork file format seemed to be going too far; by having "toepsi" as a Mac program, I could use all the ready-build MacOS services for manipulating resources).
You use the program as follows:
"ps2pict" and "toepsi" should be available at: