[comp.lang.postscript] A program to convert .ps to .eps?

HBX@psuvm.psu.edu (Terry Harrison 336 Beam BAB 3-3357) (08/20/90)

Is there a program (PD or otherwise) that will take a postscript file and
and convert it to EPS?  For example, I would like to run a postscript graph
from mathematica through it, and then include it as a \special in TeX.

thanks.

terry harrison
hbx at psuvm.psu.edu

philip@pescadero.Stanford.EDU (Philip Machanick) (08/21/90)

In article <90232.075141HBX@psuvm.psu.edu>, HBX@psuvm.psu.edu (Terry
Harrison 336 Beam BAB 3-3357) writes:
> Is there a program (PD or otherwise) that will take a postscript file and
> and convert it to EPS?  For example, I would like to run a postscript graph
> from mathematica through it, and then include it as a \special in TeX.
> 
In general, this is a difficult problem (e.g., EPS requires the bounding box
of the picture, and the absence of some global state-changing operations).

However, in the example cited, it's simple: run your Mathematica graph through
psfix, which is supplied with the Mathematica package.

Philip Machanick
philip@pescadero.stanford.edu

pvo@sapphire.OCE.ORST.EDU (Paul O'Neill) (08/23/90)

In article <90232.075141HBX@psuvm.psu.edu> HBX@psuvm.psu.edu (Terry Harrison 336 Beam BAB 3-3357) writes:
>Is there a program (PD or otherwise) that will take a postscript file and
>and convert it to EPS? ........
>

PVO's ps -> eps summary: (updated 22 aug 90)


Two lines are usually enough to fake the PS -> EPSF conversion

1) Start the postscript file with the line:
                %!PS-Adobe-2.0 EPSF-1.2

2) Include a BoundingBox: line, eg:
                %%BoundingBox: 0 0 504 378

3) For framemaker, IMPORT, do not INCLUDE the fake EPSF file.

This works for all NeXT apps requiring EPSF (including Frame2.0) and 
Frame1.3 on Sun's.  (On the Next, the file is interpreted and you get
to see it!).

To calculate the BB: 

        bbfig by Ned Batchelder sometimes works.
          [rtsg.ee.lbl.gov:dvi2ps.tar.Z]

        distill by Glenn Read usually works.
          [ Adobe fileserver
		To: ps-file-server@adobe.com
		send programs still.ps]

	epsinfo.ps usually works
	  [ Adobe fileserver:
		To: ps-file-server@adobe.com
		send Programs epsfinfo.ps]

        printing the file and measuring with a ruler always works.

        For images:
                Patch fbps to do 1) and 2)  (patch included, below)
                  [nl.cs.cmu.edu:/usr/mlm/ftp/fbm.tar.Z]
 
        For Unix plot(5) graphs:
                Use plot2ps instead of psplot.
                  [comp.sources.misc <seindal@diku.dk (Rene' Seindal)> v06i083]

==========================================================================
		     [distill & epsinfo.ps do more than BB calculation,
		      they check for "nasty" instructions and throw in
		      the proper meta-comments here and there]
========================================================================== 

*** fbps.c.orig Sun Jun 24 22:19:50 1990
--- fbps.c      Wed Jul 18 15:01:20 1990
***************
*** 58,63 ****
--- 58,64 ----
  char *argv[];
  { register int i, j;
    int rows, cols, rowlen;
+   int bbx, bby;
    double paperwidth, paperheight;
    double maxwidth, maxheight;
    double width = -1, height, llx, lly;
***************
*** 145,151 ****
  
    /* Write out PostScript Header */
    if (scribe)
!   { printf ("%%! Scribe @graphic style PostScript\n");
      if (title) { printf ("%%%%Title: %s\n", ps_chars (title)); }
      if (creator) { printf ("%%%%Creator:  %s\n", ps_chars (creator)); }
      printf ("%%%%CreationDate: %s", ctime (&clock));
--- 146,155 ----
  
    /* Write out PostScript Header */
    if (scribe)
!   { printf ("%%!PS-Adobe-2.0 EPSF-1.2\n");
!     bbx = width * 72;
!     bby = height * 72;
!     printf ("%%%%BoundingBox: 0 0 %d %d\n", bbx, bby);
      if (title) { printf ("%%%%Title: %s\n", ps_chars (title)); }
      if (creator) { printf ("%%%%Creator:  %s\n", ps_chars (creator)); }
      printf ("%%%%CreationDate: %s", ctime (&clock));




Paul O'Neill                 pvo@oce.orst.edu		DoD 000006
Coastal Imaging Lab
OSU--Oceanography
Corvallis, OR  97331         503-737-3251

hugh@slee01.srl.ford.com (Hugh Fader) (08/24/90)

I recall reading that a bitmap may optionally be included in the
eps file. The bitmap is to be used to render the postscript figure
by programs such as Frame. Does anyone know how to generate this
bitmap?
--
Hugh Fader
hugh@slee01.srl.ford.com

orthlieb@adobe.COM (Carl Orthlieb) (08/28/90)

In article <24138@fmsrl7.UUCP> hugh@slee01.srl.ford.com (Hugh Fader) writes:
>I recall reading that a bitmap may optionally be included in the
>eps file. The bitmap is to be used to render the postscript figure
>by programs such as Frame. Does anyone know how to generate this
>bitmap?

The following is an extract from the Document Structuring Conventions 
v3.0 that might help. You can get the EPSF specification from our server
(ps-file-server@adobe.COM).

	%%BeginPreview: <width> <height> <depth> <lines>
		<width> ::= <uint>  /* Width of the preview in pixels */	
		<height> ::= <uint> /* Height of the preview in pixels */
		<depth> ::= <uint>  /* Number of bits of data per pixel */
		<lines> ::= <uint>  /* Number of lines in the preview */
	%%EndPreview (no arguments)

	These comments bracket the preview section of an EPS file in 
	Interchange format (EPSI). The EPSI format is preferred over other
	platform-dependent previews (for example, Apple Macintosh and IBM
	PC) when transferring EPS files between heterogenous platforms.
	The width and height field provide the number of image samples
	(pixels) for the preview. The depth field indicates how many bits
	of data are used to establish one sample pixel of the preview
	(typical values are 1, 2, 4, or 8). The lines field indicates how
	many lines of hexadecimal data are contained in the preview, so
	that an application disinterested in the preview can easily skip
	it.

	The preview consists of a bitmap image of the EPS file, as it 
	would be rendered on the page by the print or PostScript language
	previewer. Applications that use the EPS file can then place the
	diagram in the including document. Each line of hexadecimal data
	should begin with a single percent sign. This makes the entire
	preview sectiona PostScript language comment so that the file
	can be send directly to the printer without modification.

	The EPSI preview should be placed after the %%EndComments in the
	document file, but before the defaults section (%%Begin(End)Defaults),
	if there is one, and before the prolog (%%BeginProlog) definitions.

	Note: Preview comments can be used only in documents that comply
	with the EPS file format. See "Encapsulated PostScript Files
	Specifications v3.0" for more details, including platform-specific
	versions of the preview.

Carl 8-)

ries@venice.SEDD.TRW.COM (Marc Ries) (08/29/90)

I'm cornfused.  This eps thread and my past experience (limited) seems
to imply that that an eps file should have as a minimum some postscript
instructions in ascii, even if the included bitmap is not.

However, I just purchased some (MS-DOS) T/Maker Professional EPS clip
art.  Arts and Letters has no problem converting them from EPS to their
native format (so one assumes that they are "correct" eps format).
However, when I tried printing them via UltraScript, it choked. When I
did a "less" on the files, the file is all binary -- w/o any ascii
postscript instructions?!?