


IMPS(3IM)              SDSC IMAGE LIBRARY               IMPS(3IM)



NAME
     imps - Adobe PostScript file translation

SYNOPSIS
     #include <stdio.h>
     #include "sdsc.h"
     #include "im.h"

     int ImFileWrite( fd, "ps", flagsTable, dataTable )
          int         fd;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileFWrite( fp, "ps", flagsTable, dataTable )
          FILE       *fp;
          TagTable   *flagsTable;
          TagTable   *dataTable;


DESCRIPTION
     PostScript color, grayscale, and black-and-white image files
     are  used by a variety of PostScript laser printers and win-
     dowing system tools.

FILE RECOGNITION
     PostScript files are recognized by  the  following  filename
     suffixes:  .ps and .postscript.

NOTES
     SDSC image library support of PostScript  does  not  require
     use  of  any windowing system libraries or PostScript inter-
     preters, and contains no proprietary code.  PostScript  for-
     mat  handling is available on any machine for which the SDSC
     image library is available.

     PostScript is a reverse  polish  notation-style,  FORTH-like
     programming  language  used to describe text and pictures to
     be rendered by a PostScript interpreter  embedded  within  a
     laser  printer  (such as Apple's LaserWriter printers), win-
     dowing system (such as Sun's NeWS or  NeXT's  NeXTstep),  or
     other  display  tool.   The language contains numerous basic
     programming language constructs and lots of  drawing  opera-
     tions.

     PostScript was designed for ease of  parsing,  not  ease  of
     programming.   As  a result, most people use PostScript as a
     "blackbox" file format that describes their picture.  It  is
     left up to software, such as the SDSC image library, to fig-
     ure out how to deal with PostScript.

  Reading PostScript files
     Reading of PostScript is not supported  by  the  SDSC  image



SDSC              Last change: August 19, 1992                  1






IMPS(3IM)              SDSC IMAGE LIBRARY               IMPS(3IM)



     library.   Inclusion  of  a  full PostScript language inter-
     preter in order to read PostScript  files  would  require  a
     great deal of code.  This approach is not really practical.

     Users needing to read in PostScript data should  investigate
     PostScript interpreters, such as Sun Microsystem's NeWS win-
     dow system  and  its  image  viewer  PageView(1),  or  GNU's
     GostScript PostScript-clone interpreter.

  Writing PostScript files
     The SDSC image library writes  color,  grayscale,  or  mono-
     chrome  VFBs  as  PostScript.   In  each  case the generated
     PostScript consists of a header followed by the  image  data
     as  ASCII  hex numbers.  The choice of header and the format
     of the hex numbers depends upon  the  type  of  image  being
     written.

     IMVFBMONO VFBs are written with  a  PostScript  header  that
     displays  the image in black-and-white on black-and-white or
     color devices.  Image data is written as two hex  characters
     for  each  group  of  eight  adjacent  monochrome pixels (as
     required by the PostScript image operator).

     IMVFBINDEX8 VFBs without color  lookup  tables  are  written
     with  a  PostScript header that displays the image in shades
     of gray on black-and-white or color devices.  Image data  is
     written  as  two hex characters for each grayscale pixel (as
     required by the PostScript image operator).

     IMVFBINDEX8 VFBs with a color lookup table and IMVFBRGB VFBs
     are written with a PostScript header that displays the image
     in color on color devices and in shades of  gray  on  black-
     and-white  devices.   The  PostScript header code checks the
     device's systemdict for support of the colorimage  operator.
     If  the operator exists, the device supports color.  In both
     cases, image data is written as six hex  characters  at  two
     characters each for the red, green, and blue color component
     of each pixel (as  required  by  the  PostScript  colorimage
     operator).   On  color  devices,  this color pixel data gen-
     erates a color image.  On  monochrome  devices,  the  header
     code  automatically  converts the color pixel data to shades
     of gray as it is being displayed or  printed.   This  allows
     the  same  color  PostScript  file  to  be  sent to color or
     black-and-white printers without any change to the file.

     Other image library VFB types are converted to  one  of  the
     above  prior to being written out.  See the ImFileWrite(3IM)
     man page for details.

     Image data is always generated for pixels in left  to  right
     order, from the top of the image to the bottom.




2                 Last change: August 19, 1992               SDSC






IMPS(3IM)              SDSC IMAGE LIBRARY               IMPS(3IM)



     In all cases the image is rotated and  scaled  up  automati-
     cally  to  fill  a  maximum page area without distorting the
     image.  You can override this automatic orientation and siz-
     ing by editing the generated PostScript file.  The header of
     the file contains comments describing how to do this.

     PostScript generated by the SDSC image library  conforms  to
     Adobe's version 3.0 document structuring conventions.

     _W_a_r_n_i_n_g:  All PostScript laser printers have a fixed  amount
     of  memory in which to buffer incoming data and build up the
     image  prior  to  printing.  Large   images   converted   to
     PostScript  and  then sent to a laser printer may exceed the
     buffering  and  image-building  memory  limitations  of  the
     printer.   Results  vary from printer to printer:  some lock
     up and require a reset, while  others  silently  ignore  the
     images and do not print anything.

ERRORS
     In addition to those listed for ImFileWrite(3IM), PostScript
     file writing returns the following error codes:

          IMEMALLOC   Cannot allocate enough memory
          IMESYS      System call error in write operation

DOCUMENTATION
     _P_o_s_t_S_c_r_i_p_t _L_a_n_g_u_a_g_e - _T_u_t_o_r_i_a_l _a_n_d _C_o_o_k_b_o_o_k,  Adobe  Systems
     Incorporated.

     _P_o_s_t_S_c_r_i_p_t _L_a_n_g_u_a_g_e  -  _R_e_f_e_r_e_n_c_e  _M_a_n_u_a_l,  _S_e_c_o_n_d  _E_d_i_t_i_o_n,
     Adobe Systems Incorporated.

SEE ALSO
     ImIntro(3IM),   ImErrNo(3IM),   imconv(1IM),    imfile(1IM),
     imformats(1IM), imeps(3IM)

AUTHORS
     Dave Nadeau
     San Diego Supercomputer Center

     Loren "Buck" Buchanan
     Naval Research Laboratory
     Kestrel Associates, Inc.

CONTACT
     SDSC consultants, (619)534-5100, consult@y1.sdsc.edu









SDSC              Last change: August 19, 1992                  3



