SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

POSTSCRIPT CONVERT

Name:
    POSTSCRIPT CONVERT (SET)
Type:
    Set Subcommand
Purpose:
    Specify that when a Postscript device is closed it will automatically be converted to the specified device.
Description:
    It is often desirable to import Dataplot generated graphs into external programs. This includes word processors (e.g., Word, Word Perfect), presentation software (e.g., Power Point), image manipulation programs (e.g., gimp, pbm image conversion programs), image viewers (xv), web browsers, graphics editors (e.g., Photoshop, Corel Draw), and so on.

    Most of these programs will accept Postscript or encapsulated Postscript as input. However, in some cases, non-Postscript formats are needed or preferred. For example, web browsers typically expect GIF, PNG, or JPEG images. Also, Dataplot does not generate the optional bit-map preview for encapsulated Postscript (although you can add one using Ghostview on Windows). Most programs do not actually convert Postscript files. Instead, they use the bit-map preview when displaying on non-Postscript devices and the original Postscript when displaying on Postscript devices. In these cases, it may be more convenient to import a JPEG version of the graph.

    The SET POSTSCRIPT CONVERT command is used to specify one of the following devices:

    1. JPEG
    2. PDF (Portable Document Format)
    3. TIFF (Ghostscript supports a number of tiff devices, Dataplot currently uses the "tifflzw" device)
    4. PBM (Portable Bit Map, supports black and white only)
    5. PGM (Portable Grey Map, supports greyscale, but not color)
    6. PPM (Portable Pix Map, supports color)
    7. PNM (Portable Any Map, covers PBM, PGM, PPM)

    If one of these devices is set and a Postscript device is closed, then Dataplot invokes Ghostscript to convert the Postscript output to the specified device. The original Postscript file is preserved. The new file has the same name with the file extension replaced with "jpg", "pdf", "tif", "pbm", "pgm", "ppm", or "pnm" (depending on the selected device).

    Note that Ghostscript supports conversion to a wide variety of output devices. The devices selected above were the ones that are the most useful in exporting Dataplot graphs to other software programs. Since our purpose for this command was to provide graphic formats suitable for input into other programs, we did not add support for the printer devices. If your main interest is simply in printing to a non-Postscript device, then run Ghostview after exiting Dataplot to print the Postscript file.

    Between the original Postscript and the devices supported using the SET POSTSCRIPT CONVERT, it should be possible to import Dataplot graphics into most external programs. In particular, the JPEG and PBM formats (PBM, PGM, PPM, and PNM) are supported by most image conversion programs.

Syntax:
    SET POSTSCRIPT CONVERT <device>
    where <device> is one of JPEG, PDF, TIFF, PBM, PGM, PPM, or PNM (any other choice is converted to NULL).
Examples:
    SET POSTRSCRIPT CONVERT PDF
    SET POSTRSCRIPT CONVERT JPEG
    SET POSTRSCRIPT CONVERT PPM
Note:
    This command assumes that Ghostscript is installed on your local system. Currently, it is implemented on Unix (this includes Linux, Mac OSX, and FreeBSD) and Windows platforms. It can easily be extended to any platform (e.g., VAX VMS) to which Ghostscript has been ported. Contact Alan Heckert (alan.heckert@nist.gov) if you have a platform that you would like supported.

    For Unix platforms, Ghostscript is launched with the command

      gs

    If gs is not in your default path, you can enter something like

      set ghostscript path /usr/local/bin

    On Windows platforms, Ghostscript is launched with

      <ghostscript path>\GSWIN32C.EXE

    where <ghostscript path> is the directory defined by the SET GHOSTSCRIPT PATH command. As of the 05/2016 version of Dataplot, the default path is

      C:\Program Files\GS\GS9.10\BIN

    If Ghostscript is installed in a different directory (typically the "GS9.10" will be different if you have installed a different version of Ghostscript), you can specify the correct directory with the command

      SET GHOSTSCRIPT PATH <path-name>

    Enter HELP GHOSTSCRIPT PATH for details.

    If you have installed the 64-bit version of Ghostscript, enter the command

      SET GHOSTSCRIPT VERSION 64

    This will run the command GSWIN64C.EXE instead of GSWIN32C.EXE. To reset the 32-bit version, enter

      SET GHOSTSCRIPT VERSION 32
Note:
    By default, the conversion is performed by Ghostscript. You can also specify the "convert" program that is part of the Image Magick software by entering the command

      SET POSTSCRIPT CONVERT CONVERT

    To reset the use of Ghostscript, enter

      SET POSTSCRIPT CONVERT GHOSTSCRIPT
Note:
    The converted image is created with a density of 72 dots per inch in both the horizontal and vertical directions. You can specify a different resolution with the commands

      SET CONVERT DENSITY HORIZONTAL <value>
      SET CONVERT DENSITY VERTICAL <value>
Note:
    When converting to an image format, you will typically want each graph in a separate file. You can do this as follows:

      SET POSTSCRIPT CONVERT JPEG
      ORIENTATION LANDSCAPE WORDPERFECT
      SET IPL1NA PLOT1.PS
      DEVICE 2 POSTSCRIPT
      ... generate first plot ...
      DEVICE 2 CLOSE
      SET IPL1NA PLOT2.PS
      DEVICE 2 POSTSCRIPT
      ... generate second plot ...
      DEVICE 2 CLOSE

    After these commands are run, you will have the Postscript files PLOT1.PS and PLOT2.PS. In addition, you will have the JPEG files PLOT1.jpg and PLOT2.jpg.

    PDF may sometimes be the exception. Acroread (and other PDF viewers) can read PDF files with multiple graphs in them.

Note:
    The CAPTURE HTML command is used to generate Dataplot output to a web page.

    If the PDF format is specified and the CAPTURE HTML command is activated, Dataplot will generate a link to the PDF file in the generated HTML code. Enter HELP CAPTURE for more information about the CAPTURE HTML option

Note:
    On some platforms, Dataplot can generate PNG and JPEG image files directly. Enter HELP GD for details.
Default:
    The default is device is NULL (i.e., no conversion is performed).
Synonyms:
    SET OUTPUT DEVICE
Related Commands:
    DEVICE xx POSTSCRIPT = Set the device to Postscript.
    PP = Print the current plot.
    SET GHOSTSCRIPT PATH = Set the directory where Ghostscript is installed.
    SET GHOSTVIEW PATH = Set the directory where Ghostview (and GSPRINT) is installed.
    SET GHOSTSCRIPT PRINTER = Use Ghostview as the default printer under Windows.
    GD = Specify the GD device for generating PNG and JPEG graphics.
Applications:
    Graphics Output
Implementation Date:
    2003/01
    2007/10: Added support for "convert" program from ImageMagick
    2009/03: Added support for user specified density
Program:
     
        SET GHOSTSCRIPT PATH /usr/local/src/bin/
        SET POSTSCRIPT CONVERT JPEG
        DEVICE 2 POSTSCRIPT
        PLOT SIN(X) FOR X = -6 0.1 6
        DEVICE 2 CLOSE
        SYSTEM xv dppl1f.jpg
        

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 01/24/2003
Last updated: 05/18/2016

Please email comments on this WWW page to alan.heckert@nist.gov.