globus@nas.nasa.gov (Al Globus) (04/12/91)
I need to do this for a paper I'm writing (to get some figures in it). Someone else posted this question but there weren't any responses on the net. Thanx in advance.
orthlieb@adobe.COM (Carl Orthlieb) (04/13/91)
An Encapsulated PostScript file (EPSF) is a standard format for importing and exporting PostScript language files in all environments. It is usually a single page PostScript language program that describes an illustration. The purpose of the EPS file is to be included as an illustration in other PostScript language page descriptions. The EPS file can contain any combination of text, graphics, and images. An EPS file is the same as any other PostScript language page description, with some restrictions. EPS files can optionally contain a bitmapped image preview, so that systems that can't render PostScript directly can at least display a crude representation of what the graphic will look like. There are three preview formats: Mac (PICT), IBM (tiff), and a platform independent preview called EPSI. An EPS file must be a conforming file, that is, it must conform to the document structuring conventions (DSC). At a minimum, it must include a header comment, %!PS-Adobe-3.0 EPSF-3.0, and a bounding box comment, %%BoundingBox: llx lly urx ury, that describes the bounds of the illustration. Optional comments include font usage (%%DocumentFonts: or %%DocumentNeededResources: font), EPSI preview comments (%%Begin(End)Preview:) extensions (%%Extensions:) and language level (%%LanguageLevel:). There are some operators that should not be used within an EPS file: banddevice cleardictstack copypage erasepage exitserver framedevice grestoreall initclip initgraphics initmatrix quit renderbands setglobal setpagedevice setshared startjob These also include operators from statusdict and userdict operators like legal, letter, a4, b5, etc. There are some operators that should be carefully used: nulldevice setgstate sethalftone setmatrix setscreen settransfer undefinefont In Appendix I of the new red book, 'Guidelines for Specific Operators', there is a more in-depth discussion of these operators. --- CONVERTING PostScript TO EPSF --- There is a PostScript program available on our mail server called 'epsfinfo' that should do what you want. You tack it onto the head of your PS file and then send it down to the printer using SendPS or LaserTalk. You will then get back the bounding box and font usage info for your PS file. If you then change the top of your file to read: %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: <llx> <lly> <urx> <ury> %%DocumentFonts: <font1> <font2> <font3> ... you should then have an EPS file (w/o a preview). <llx>, <lly>, <urx>, and <ury> are the bounding box values sent back by the epsfinfo program (make sure that these are integer values). <font1>, <font2>, <font3>, etc. are the names of the fonts used by your file (e.g. Times-Roman). Note that there are some PS operators that should not be used in an EPS file. The epsfinfo program will notify you if your PS file uses these operators. See Appendix I of the new red book for more info. Hope this helps, Carl 8-) P.S. The file you want from the server is Programs/epsfinfo.ps ----------- Server Access Information ----------- The PS-File-Server is an automatic mail-response program. That means you mail it a request, and it mails back the response. It is not accessible via anonymous FTP. To get in touch with the server, send a message to the appropriate address, either: uucp: {sun,decwrl}!adobe!ps-file-server OR internet: ps-file-server@adobe.COM containing the word "help" in either the Subject: field or the message body. It will reply with a message on how to use the available services. There are many items available from the server; Documents (as PostScript files), program sources, Adobe Font Metrics files, PostScript Printer Description files, and other itmes. You might send a separate message containing the word "index" to save some time once you get the help message. The file server does not respond to requests from users named "root", "system", "daemon", or "mailer". This is to prevent mail loops from bounced messages. Note: If you do not receive help from the server within a day or so, it is probably because the server's mail to you has bounced. You can try again and use the "path" command within your message specifying a known return path that the server should use. For example: path pyramid!rutgers!zakkaroo!jj (substitute whatever address is appropriate) If you have any problems contacting the server, or you have any suggestions, please send a message to the moderator (ps-file-person@adobe.COM). Carl 8-)
mass@hobiecat.cs.caltech.edu (Mass Sivilotti) (04/21/91)
>>>>> On 12 Apr 91 17:49:28 GMT, orthlieb@adobe.COM (Carl Orthlieb) said:
Carl> An Encapsulated PostScript file (EPSF) is a standard format for importing and
Carl> exporting PostScript language files in all environments. It is usually a
Carl> single page PostScript language program that describes an illustration. The
Carl> purpose of the EPS file is to be included as an illustration in other
Carl> PostScript language page descriptions. The EPS file can contain any
Carl> combination of text, graphics, and images. An EPS file is the same as any
Carl> other PostScript language page description, with some restrictions.
Carl> EPS files can optionally contain a bitmapped image preview, so that systems
Carl> that can't render PostScript directly can at least display a crude
Carl> representation of what the graphic will look like. There are three
Carl> preview formats: Mac (PICT), IBM (tiff), and a platform independent preview
Carl> called EPSI.
Does anybody out there have a good way to generate these bitmapped previews,
and include them in an EPSF file. In particular, Word for Windows on the PC
would like a TIFF preview (and some other binary stuff) prepended onto
a PostScript illustration.
I have a large body of PostScript illustrations that would love to be
imported into WfW. Any help would be appreciated.
--mass
(mass@hobiecat.cs.caltech.edu)
boyter@bimbo.uucp (Maj Brian Boyter) (04/21/91)
mass@hobiecat.cs.caltech.edu (Mass Sivilotti) writes: >Does anybody out there have a good way to generate these bitmapped previews, >and include them in an EPSF file. In particular, Word for Windows on the PC I made some modifications to a program called "xv".... One of the mods enables xv to output an eps file... The process isn't especially streamlined, but here's how I do it: 1) use a postscript interpreter to get the postscript image rendered onto the screen of my Sun workstation (I use "pageview", an OpenWindows utility)... 2) Capture the rendered postscript from the Sun's screen into a rasterfile (I use "snapshot", another OpenWindows utility)... 3) Read in the rasterfile and output the EPS file using "xv"... I have found that I usually have to crop the image, and I also have to edit the colormap... The problem is that although the EPS spec will permit a "gray-scale" image, most programs that I have seen that use the preview portion of the EPS only can handle a bitmap... So, you have to tell "xv" which colors you want mapped to black and which colors you want mapped to white... Same is true for gray scale images... I guess I could have written code that would have picked the color -> black/white mapping automatically, but it probably wouldn't map it the way the user really wanted it mapped... 4) the output of xv is an EPS file with a bitmap (i.e. black-and-white) preview section, followed by a postscript "image".... The final step is to discard the postscript image, and replace it with the original postscript file... I'm not partial to having to go through 4 steps to make an EPS file... If someone has a better way of doing this, I'd like to hear it... I'd be glad to give out my modified version of "xv".... I sent the changes to the author of xv (John Bradley - bradley@cis.upenn.edu), but he's working on making xv into a commercial product so I'm not sure if/when he's gonna publish another release of xv.... Brian boyter@fstc-chville.army.mil -- --------------------------------------------------------------- Maj. Brian A Boyter US Army Foreign Science & Technology Center Charlottesville, Va 22901 __ off: (804)980-7362 ( ) home: 973-9440 { } ( ) boyter@fstc-chville.army.mil || || Just say glow...... _______< >_______
mikec@wam.umd.edu (Michael D. Callaghan) (04/21/91)
In article <MASS.91Apr20195134@hobiecat.cs.caltech.edu> mass@hobiecat.cs.caltech.edu (Mass Sivilotti) writes: >Does anybody out there have a good way to generate these bitmapped previews, >and include them in an EPSF file. In particular, Word for Windows on the PC >would like a TIFF preview (and some other binary stuff) prepended onto >a PostScript illustration. > >I have a large body of PostScript illustrations that would love to be >imported into WfW. Any help would be appreciated. I would find someone with a NeXT, and execute the PS code under Preview. Then, using the Grab application, highlight the thing on-screen image, and Save As [tiff]. I've shuffled tiff images back and forth from my NeXT to a Mac, and there is no problem. I've never put a tiff on a PC running Windows, but it shouldn't take too much to find out. -- MikeC _________________________________________________________ Michael D. Callaghan, MDC Designs, University of Maryland mikec@wam.umd.edu
dgc@cs.purdue.EDU (Doug Crabill) (04/22/91)
In article <MASS.91Apr20195134@hobiecat.cs.caltech.edu> mass@hobiecat.cs.caltech.edu (Mass Sivilotti) writes: > Carl> EPS files can optionally contain a bitmapped image preview, so that systems > Carl> that can't render PostScript directly can at least display a crude > Carl> representation of what the graphic will look like. There are three > Carl> preview formats: Mac (PICT), IBM (tiff), and a platform independent preview > Carl> called EPSI. > > Does anybody out there have a good way to generate these bitmapped > previews, and include them in an EPSF file. In particular, Word > for Windows on the PC would like a TIFF preview (and some other > binary stuff) prepended onto a PostScript illustration. > > I have a large body of PostScript illustrations that would love to > be imported into WfW. Any help would be appreciated. > > --mass > (mass@hobiecat.cs.caltech.edu) I have a solution which easily generates the "platform independent preview called EPSI". It can probably be modified to generate TIFF previews if you are so inclined. The preview it generates works well with FrameMaker, among others, and the BoundingBox information it generates is application independent. I posted this a couple months ago, but apparently everyone was on spring break that week ;-) Doug There have been many requests for a program to convert from PS to EPS, from PS to EPSI, from PS to EPSF, from EPS to EPSI, and from PS to a variety of bitmap forms. I have written (glued together) a simple solution. You give my program (pstoepsi) arbitrary PostScript, and it converts it to Encapsulated PostScript (BoundingBox information) with a bitmap representation of the image in comments (EPSI format). It doesn't require unnecessary printing and hand editing of PostScript source to calculate BoundingBox information (as is needed with bb.ps). Pipe the rest of this message through /bin/sh to unshar and read the README for more information. Doug Crabill Department of Computer Science Purdue University dgc@cs.purdue.edu #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: README pbmtoepsi.c pstoepsi pstorast # Wrapped by dgc@orion.cs.purdue.edu on Tue Mar 12 10:22:04 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(2401 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' XDESCRIPTION X XThese scripts allow arbitrary PostScript to be converted to XEncapsulated PostScript with a bitmap (EPS, EPSI, EPSF). The real Xwork has been done by the authors of PBMPLUS (Jef Poskanzer), XGhostScript (L. Peter Deutsch), and OpenWindows (Sun). All I have Xdone is supply some glue to put all of these other applications to Xwork. It is beyond me why it has not been done before, especially Xconsidering the number of requests (pleas) for such a conversion Xprogram. X XI am providing these scripts with no guarantee, but will maintain them Xand fix bugs if you send them. X XDoug Crabill Xdgc@cs.purdue.edu X X XREQUIREMENTS X XYou must have the PBMPLUS utilities. X XYou must have either OpenWindows, GhostScript, or both. X XPBMPLUS is available via anonymous ftp from export.lcs.mit.edu in Xcontrib/pbmplus.tar.Z, OpenWindows is available from Sun, and XGhostScript is available via anonymous ftp from prep.ai.mit.edu in Xpub/gnu/ghostscript-2.1.1.tar.Z (watch for newer versions). X X XINSTALLATION X XDrop pbmtoepsi.c into the pbmplus source (in the pbm subdirectory), Xadd it to the Makefile, and make. Put the executable with the other Xpbm binaries. X XPut pstorast (formerly pstobits, posted by someone else in the past -- Xdon't remember who) in an appropriate location (/usr/local/bin, or Xwhatever). X XEdit pstoepsi and change all of the variables at the top so they match Xyour local configuration. X X XHOW TO USE IT X XRead the pstoepsi shell script for usage. X X XHOW IT WORKS X XThe conversion works by interpreting the source PostScript using Xeither X/NeWS (provided with OpenWindows) in batch mode or GhostScript Xin batch mode, converting the result into a portable bitmap, running it Xthrough pbmtoepsi, which converts it to a PostScript style bitmap Xcomplete with bounding box information, and concatenating the result Xwith the original PostScript. X XUsing X/NeWS for the conversion generally takes longer, but yields a Xsharper bitmap than with GhostScript. It is convenient to have both Xavailable because occasionally you will want to convert PostScript Xwhich will cause one or other of the interpreters to fail. If you Xwant to encapsulate PostScript which already thinks it is Xencapsulated, you should probably use the "-strip" option to pstoepsi. XThis will strip out all of the old encapsulation and add new Xencapsulation. X X XDoug Crabill XDepartment of Computer Science XPurdue University Xdgc@cs.purdue.edu END_OF_FILE if test 2401 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'pbmtoepsi.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'pbmtoepsi.c'\" else echo shar: Extracting \"'pbmtoepsi.c'\" \(2248 characters\) sed "s/^X//" >'pbmtoepsi.c' <<'END_OF_FILE' X/* pbmtoepsi.c X** X** by Doug Crabill, based heavily on pbmtoascii X** X** Converts a pbm file to an encapsulated PostScript style bitmap. X** Note that it does NOT covert the pbm file to PostScript, only to X** a bitmap to be added to a piece of PostScript generated elsewhere. X** X** Copyright (C) 1988 by Jef Poskanzer. X** X** Permission to use, copy, modify, and distribute this software and its X** documentation for any purpose and without fee is hereby granted, provided X** that the above copyright notice appear in all copies and that both that X** copyright notice and this permission notice appear in supporting X** documentation. This software is provided "as is" without express or X** implied warranty. X*/ X X#include "pbm.h" X X#if !defined(MAXINT) X#define MAXINT (0x7fffffff) X#endif X Xmain( argc, argv ) X int argc; X char *argv[]; X{ X FILE *ifd; X register bit **bits; X int rows, cols, row, col, tot, count; X int top = MAXINT, bottom = -MAXINT, left = MAXINT, right = -MAXINT; X X pbm_init( &argc, argv ); X X if ( argc > 2 ) X pm_usage( "[pbmfile]" ); X X if ( argc == 2 ) X ifd = pm_openr( argv[1] ); X else X ifd = stdin; X X bits = pbm_readpbm( ifd, &cols, &rows ); X X pm_close( ifd ); X X for (row = 0; row < rows; row++) { X for (col = 0; col < cols; col++) { X if (bits[row][col] == PBM_BLACK) { X if (row < top) { X top = row; X } X if (row > bottom) { X bottom = row; X } X if (col < left) { X left = col; X } X if (col > right) { X right = col; X } X } X } X } X X printf("%%!PS-Adobe-2.0 EPSF-1.2\n"); X printf("%%%%BoundingBox: %d %d %d %d\n", left, rows - bottom, right, rows - top); X printf("%%%%BeginPreview: %d %d 1 %d\n", right - left + 1, bottom - top + 1, bottom - top + 1); X X for (row = top; row <= bottom; row++) { X printf("%% "); X count = 0; X for (col = left; col <= right; col += 4) { X tot = 0; X if (bits[row][col] == PBM_BLACK) { X tot += 8; X } X if (bits[row][col+1] == PBM_BLACK) { X tot += 4; X } X if (bits[row][col+2] == PBM_BLACK) { X tot += 2; X } X if (bits[row][col+3] == PBM_BLACK) { X tot++; X } X printf("%x", tot); X count++; X } X printf((count % 2) == 0 ? "\n" : "0\n"); X } X printf("%%%%EndImage\n"); X printf("%%%%EndPreview\n"); X X exit( 0 ); X} END_OF_FILE if test 2248 -ne `wc -c <'pbmtoepsi.c'`; then echo shar: \"'pbmtoepsi.c'\" unpacked with wrong size! fi # end of 'pbmtoepsi.c' fi if test -f 'pstoepsi' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'pstoepsi'\" else echo shar: Extracting \"'pstoepsi'\" \(1925 characters\) sed "s/^X//" >'pstoepsi' <<'END_OF_FILE' X#!/bin/sh X# Script to convert an arbitrary PostScript image to an encapsulated X# PostScript image with a bitmap, suitable for incorporation into X# FrameMaker, LaTeX, troff, etc. X# X# Options: X# -gs Use ghostscript to convert to EPSI X# -news Use Sun's X/NeWS (OpenWindows) to convert to EPSI X# -strip Strip all %% directives from the source file -- useful X# when dealing with Adobe Illustrator and others who X# use directives incompatible with this coversion. X# X# Note in the USAGE line below, the source PostScript file must end X# in a .ps extention. This is a GhostScript requirement, not mine... X# X# I am providing this without any guarantee. X# X# Thu Nov 29 10:57:05 EST 1990 X# X# Doug Crabill dgc@cs.purdue.edu X XUSAGE="Usage: $0 [ -gs | -news ] [ -strip ] <file>.ps <file>.epsi" X X########################## Edit these variables ##################### XGS='/usr/local/gnu/gs' XPSTOPPM='/usr/local/gnu/lib/gs/pstoppm.ps' XPBMTOEPSI='/usr/local/pbm/pbmtoepsi' XRASTTOPNM='/usr/local/pbm/rasttopnm' XINTERP='gs' XSTRIP='false' XPSTORAST='./pstorast' X###################################################################### X Xfor A do X case $A in X -gs) INTERP='gs' X shift X ;; X -news) INTERP='news' X shift X ;; X -strip) STRIP='true' X shift X ;; X *) break X ;; X esac Xdone X XBASE=`basename "$1" .ps` X Xif [ $# -ne 2 -o ! -f "$1" -o "$1" = "$BASE" ] ; then X echo $USAGE 1>&2 X exit 1 Xfi X XTMP1="/tmp/$USER.1.$$" XTMP2="/tmp/$USER.2.$$" XTMP3="/tmp/$USER.3.$$" Xtrap 'rm -f $TMP1 $TMP2 ${BASE}.ppm; exit' 1 2 3 4 13 15 X Xif [ "true" = "$STRIP" ] ; then X awk '/^%%/ { next } {print}' < $1 > $TMP3 Xelse X TMP3="$1" Xfi X Xif [ "gs" = "$INTERP" ] ; then X $GS -q -dNODISPLAY $PSTOPPM << DGC X ($BASE) ppm1run XDGC X $PBMTOEPSI ${BASE}.ppm > $TMP1 X cat $TMP1 $TMP3 > $2 Xelse X $PSTORAST -in $TMP3 -out $TMP1 X $RASTTOPNM < $TMP1 | $PBMTOEPSI > $TMP2 X cat $TMP2 $TMP3 > $2 Xfi X Xif [ "$1" != "$TMP3" ] ; then X rm -f $TMP3 Xfi Xrm -f $TMP1 $TMP2 ${BASE}.ppm X Xexit 0 END_OF_FILE if test 1925 -ne `wc -c <'pstoepsi'`; then echo shar: \"'pstoepsi'\" unpacked with wrong size! fi chmod +x 'pstoepsi' # end of 'pstoepsi' fi if test -f 'pstorast' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'pstorast'\" else echo shar: Extracting \"'pstorast'\" \(1632 characters\) sed "s/^X//" >'pstorast' <<'END_OF_FILE' X#! /bin/sh X# @(#)ps2bits 1.2 89/12/12 X# ps2bits - PostScript to Rasterfile converter. X# X XUSAGE="Usage: `basename ${0}` [-in s] [-out s] [-dpi x y] [-size w h] [-color]" XOUT="pspage" XIN="%stdin" XDPIX=72 XDPIY=72 XXSIZE=8.5 XYSIZE=11 XDEPTH=1 X Xexport OPENWINHOME XNEWSHOME LD_LIBRARY_PATH X XOPENWINHOME="${OPENWINHOME-/usr/local/OpenWindows}" XXNEWSHOME=${OPENWINHOME} XLD_LIBRARY_PATH=${OPENWINHOME}/lib:/lib X Xif [ ! -f $OPENWINHOME/etc/NeWS/redbook.ps ]; then X echo "`basename $0`: xnews is not installed correctly in $OPENWINHOME" 1>&2 X echo " (set \$OPENWINHOME to where it is installed...)" 1>&2 X exit 1 Xfi X Xwhile [ ${#} -gt 0 ]; do X case "${1}" in X -color) shift; X DEPTH=8 X ;; X -out) shift; X OUT=${1} shift X ;; X -in) shift; X IN=${1} shift X ;; X -size) shift; X XSIZE=${1} shift; X YSIZE=${1} shift X ;; X -dpi) shift; X DPIX=${1} shift; X DPIY=${1} shift X ;; X *) echo ${USAGE}; X exit 0 X ;; X esac Xdone X X$OPENWINHOME/bin/xnews -init " X /currentpacking false def X /setpacking { pop } def X (NeWS/basics.ps) (r) file cvx exec X (NeWS/redbook.ps) (r) file cvx exec X X 500 dict begin % start userdict X false setautobind X /bind {} def X X /showpage { copypage erasepage initgraphics } def X /_pageno 0 def X /copypage { X /_pageno _pageno 1 add store X (${OUT}) X clippath writecanvas X } def X X ${DPIX} ${XSIZE} mul ${DPIY} ${YSIZE} mul ${DEPTH} X [ ${DPIX} 72 div 0 0 ${DPIY} 72 div neg 0 7 index ] X null buildimage setcanvas X erasepage initgraphics X X % hack for bug in folio initialization code. X /Courier findfont 10 scalefont setfont () stringwidth pop pop X X (${IN}) (r) file cvx exec X shutdownserver X" X END_OF_FILE if test 1632 -ne `wc -c <'pstorast'`; then echo shar: \"'pstorast'\" unpacked with wrong size! fi chmod +x 'pstorast' # end of 'pstorast' fi echo shar: End of shell archive. exit 0