.TL
Pstopnm User Manual
.SH 1
pstopnm
.LP
Updated: 28 May 2003
.br
Table Of Contents
.SH 2
NAME
.LP
pstopnm - convert a PostScript file to a PNM image
.SH 2
SYNOPSIS
.LP
\fBpstopnm\fR
[\fB-stdout\fR]
[\fB-forceplain\fR]
[\fB-help\fR]
[\fB-dpi=\fR\fIdpi\fR]
[\fB-xsize=\fR\fIpixels\fR]
[\fB-ysize=\fR\fIpixels\fR]
[\fB-xborder=\fR\fIfrac\fR]
[\fB-yborder=\fR\fIfrac\fR]
[\fB-landscape\fR]
[\fB-portrait\fR]
[\fB-nocrop\fR]
[\fB-pbm\fR
|\fB-pgm\fR
|\fB-ppm\fR]
[\fB-llx=\fR\fIs\fR]
[\fB-lly=\fR\fIs\fR]
[\fB-urx=\fR\fIs\fR]
[\fB-ury=\fR\fIs\fR]
[\fB-verbose\fR]
[\fB-xmax=\fR\fIpixels\fR]
[\fB-ymax=\fR\fIpixels\fR]
\fIpsfile\fR[\fB.ps\fR]
<?makeman .SH OPTION USAGE ?>
.LP
Minimum unique abbreviation of option is acceptable. You may use
double hyphens instead of single hyphen to denote options. You may use
white space in place of the equals sign to separate an option name
from its value.
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBpstopnm\fR reads a PostScript file as input and produces PBM,
PGM, or PPM images as output. This program simply uses GhostScript to
render a PostScript file with its PNM device drivers. If you don't
have GhostScript installed or the version you have installed was not
built with the relevant PNM device drivers, \fBpstopnm\fR will fail.
You can see if you have the proper environment by issuing the command
\f(CWgs --help \fR. If it responds and lists under "Available
Devices" \fBpbm\fR, \fBpbmraw\fR, \fBpgm\fR, \fBpgmraw\fR,
\fBpnm\fR, \fBpnmraw\fR, \fBppm\fR, or \fBppmraw\fR, you're in
business.
.LP
\fBpstopnm\fR uses the value of the \fBGHOSTSCRIPT\fR
environment variable as the file name for the Ghostscript program. If
\fBGHOSTSCRIPT\fR is not set, \fBpstopnm\fR searches your
\fBPATH\fR for a regular file named \fBgs\fR. If it doesn't find
one, it assumes Ghostscript is in the file \fB/usr/bin/gs\fR.
.LP
\fBpstopnm\fR does not use the Netpbm libraries to generate the
output files, so may not be entirely consistent with most Netpbm
programs.
.LP
\fIpsfile\fR[\fB.ps\fR] is the name of the input file.
\fBpstopnm\fR will add the \fBps\fR to the end of the name you
specify if no file exists by the exact name you specify, but one with
added does. Use \fB-\fR to indicate Standard Input.
.LP
If you use the \fB-stdout \fR option, \fBpstopnm\fR outputs
images of all the pages as a multi-image file to Standard Output.
Otherwise, \fBpstopnm\fR creates one file for each page in the
Postscript document. The files are named as follows: If the input
file is named \fBpsfile.ps\fR, the name of the files will be
\fBpsfile001.ppm\fR, \fBpsfile002.ppm\fR, etc. The filetype suffix
is \fB.ppm\fR, \fB.pgm\fR, or \fB.pbm\fR, depending on which kind
of output you choose with your invocation options. If the input file
name does not end in \fB.ps\fR, the whole file name is used in the
output file name. For example, if the input file is named
\fBpsfile.old\fR, the output file name is \fBpsfile.old001.ppm\fR,
etc.
.LP
Note that the output file selection is inconsistent with most
Netpbm programs, because it does not default to Standard Output. This
is for historical reasons, based on the fact that the Netpbm formats
did not always provide for a sequence of images in a single file.
.LP
Each output image contains a rectangular area of the page to which
it pertains. See the Dimensions section for
details on what part of the input image goes into the output image and
how big it is in the output and what borders and margins are in the
output image.
.LP
It has been reported that on some Postscript Version 1 input,
Ghostscript, and therefore \fBpstopnm\fR, produces no output. To
solve this problem, you can convert the file to Postscript Version 3
with the program \fBps2ps\fR. It is reported that the program
\fBpstops\fR does not work.
.SH 3
Dimensions
.LP
.LP
This section describes what part of the input image gets used in
the output and the dimensions of the output, including borders and
background.
.LP
Note that an output image is associated with a single input page.
\fBpstopnm\fR starts by taking a rectangular area from the input page.
That is called the subject image.
.LP
\fBpstopnm\fR may add borders to the subject image to form what is called
the bordered subject image.
.LP
\fBpstopnm\fR places the bordered subject image in the center of
the output image and clips the edges as necessary to fit the computed
output image size.
.LP
The location of the subject image in the Postscript input page is
defined by four numbers, the lower left corner and the upper right
corner x and y coordinates. These coordinates are usually specified
by the BoundingBox DSC statement (a Postscript comment) in the
PostScript file, but they can be overridden by the user by specifying
one or more of the following options: \fB-llx\fR, \fB-lly\fR,
\fB-urx\fR, and \fB-ury\fR.
.LP
The presence and thickness of a border to be added to the subject
image to form the bordered subject image is controlled by the options
\fB-xborder\fR and \fB-yborder\fR. If \fBpstopnm\fR does not find
a BoundingBox statement in the input, and you don't specify image area
coordinates on the command line, \fBpstopnm\fR uses default values.
If your input is from Standard Input, \fBpstopnm\fR does not use the
BoundingBox values (due to the technical difficulty of extracting that
information and still feeding the file to Ghostscript), so you either
have to specify the image area coordinates or take the default.
.LP
The output image size is a confusing thing. In a Postscript file,
things have spatial dimensions. For example, a particular line may be
3 centimeters long. A Postscript printer is supposed to print the
line 3 centimeters long, using however many pixels that takes, without
regard to how big the sheet of paper on which it is printing is. In a
PNM image, by contrast, there is no spatial dimension; there are only
pixels. You might have a line that is 100 pixels long, but the PNM
image says nothing about how long that line should be on a printed
page.
.LP
\fBpstopnm\fR fills the role of a Postscript printer. The PNM image
is a virtual printed page. \fBpstopnm\fR must determine how many pixels
it will use in the output image to represent an inch of input image,
which is the "output device resolution." Think of it as the number of
dots per inch the virtual printer prints on the virtual page.
.LP
The simplest thing is for you to tell \fBpstopnm\fR exactly what
output device resolution to use, using the \fB-dpi\fR option. If you
say for example \fB-dpi=300\fR and the bordered subject image is 2
inches by 2 inches, the PNM output will be 600 pixels by 600 pixels.
.LP
Or you can set the output image dimensions with \fB-xsize\fR and
\fB-ysize\fR. For example, if you say \fB-xsize=1000 -ysize=1000\fR
and the bordered subject image is 2 inches by 2 inches, the output
image is 1000 by 1000 pixels, with each pixel representing 1/500 inch
of input image.
.LP
If you specify one of \fB-xsize\fR and \fB-ysize\fR and not the
other, \fBpstopnm\fR defaults the other such that the output image
has the same aspect ratio as the bordered subject image.
.LP
If you specify neither the output size nor the output device
resolution, \fBpstopnm\fR does some weird computation which exists
mainly for historical reasons:
.LP
If you specify \fB-nocrop\fR, \fBpstopnm\fR uses the values of
\fB-xmax\fR and \fB-ymax\fR for the output image dimensions. These
default to 612 and 792 pixels, respectively.
.LP
The final case, the default, is where you don't specify any size or
resolution options of \fB-nocrop\fR. This is the most complicated
case. In this case, \fBpstopnm\fR first chooses an output device
resolution that would generate the number of pixels indicated by
\fB-xmax\fR and \fB-ymax\fR from the bordered subject image. Then,
based on that resolution, it chooses an output image size that is just
large enough to accomodate the subject image (no borders). Remember
(above) that \fBpstopnm\fR trims the edges of the bordered subject
image to fit the computed output size.
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-forceplain\fR"
forces the output file to be in plain (text) format. Otherwise,
it is in raw (binary) format. See \fBpbm\fR,
etc.
.IP "\fB-llx=\fR\fIbx\fR"
selects \fIbx\fR as the lower left corner x coordinate (in
inches) on the Postscript input page of the subject image.
See the Dimensions section.
.IP "\fB-lly=\fR\fIby\fR"
selects \fIby\fR as the lower left corner y coordinate (in inches)
on the Postscript input page of the subject image.
See the Dimensions section.
.IP "\fB-landscape\fR"
renders the image in landscape orientation.
.IP "\fB-portrait\fR"
renders the image in portrait orientation.
.IP "\fB-nocrop\fR"
This option causes \fBpstopnm\fR to make the output image
exactly the dimensions of the bordered subject image. By default,
\fBpstopnm\fR makes the output image the dimensions specified by
\fB-xmax\fR and \fB-ymax\fR. See the Dimensions
section.
.IP "\fB-pbm\fR"
.IP "\fB-pgm\fR"
.IP "\fB-ppm\fR"
selects the format of the output file. By default, all files are
rendered as portable pixmaps (ppm format).
.IP "\fB-stdout\fR"
causes output to go to Standard Output instead of to regular
files, one per page (see description of output files above). Use
\fBpnmsplit\fR to extract individual pages from Standard Output.
.IP "\fB-urx=\fR\fItx\fR"
selects \fItx\fR as the upper right corner x coordinate (in
inches) on the Postscript input page of the subject image. See the Dimensions section.
.IP "\fB-ury=\fR\fIty\fR"
selects \fIty\fR as the upper right corner y coordinate (in
inches) on the Postscript input page of the subject image. See the Dimensions section.
.IP "\fB-verbose\fR"
prints processing information to stdout.
.IP "\fB-xborder=\fR\fIfrac\fR "
specifies that the left and right borders added to the subject
image are to be \fIfrac\fR times the subject image width. The
default value is 0.1. See the Dimensions
section.
.IP "\fB-xmax=\fR\fIxmax\fR"
specifies that the output image is to be \fIxmax\fR pixels wide.
The default is 612. See the Dimensions
section.
.IP "\fB-xsize=\fR\fIxsize\fR"
specifies that the output image is to be \fIxsize\fR pixels wide.
See the Dimensions section.
.IP "\fB-yborder=\fR\fIfrac\fR"
specifies that the top and bottom borders added to the subject
image are to be \fIfrac\fR times the subject image height. The
default value is 0.1. See the Dimensions
section.
.IP "\fB-ymax=\fR\fIymax\fR"
specifies that the output image is to be \fIymax\fR pixels high.
The default is 792. See the Dimensions
section.
.IP "\fB-ysize=\fR\fIysize\fR"
specifies that the output image is to be \fIymax\fR pixels high.
See the Dimensions section.
.IP "\fB-dpi=\fR\fIdpi\fR"
specifies the output device resolution, in dots per inch, of the
Postscript printer that \fBpstopnm\fR simulates. This is the number of
PNM pixels \fBpstopnm\fR generates for each inch of image.
See the Dimensions section.
.LP
This option was new in Netpbm 10.21 (March 2004).
.RE
.SH 2
LIMITATIONS
.LP
.LP
The program will produce incorrect results with PostScript files that
initialize the current transformation matrix. In these cases, page
translation and rotation will not have any effect. To render these
files, probably the best bet is to use the following options:
.DS L
pstopnm -xborder 0 -yborder 0 -portrait -nocrop file.ps
.DE
.LP
Additional options may be needed if the document is supposed to be
rendered on a medium different from letter-size paper.
.SH 2
SEE ALSO
.LP
\fBgs\fR,
\fBpnmtops\fR,
\fBpsidtopgm\fR,
\fBpbmtolps\fR,
\fBpbmtoepsi\fR,
\fBpnmsplit\fR,
\fBpstofits\fR
.SH 2
COPYRIGHT
.LP
.LP
Copyright (c) 1992 Smithsonian Astrophysical Observatory
.LP
PostScript is a Trademark of Adobe Systems Incorporated.
.SH 2
AUTHOR
.LP
.LP
Alberto Accomazzi, WIPL, Center for Astrophysics.
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
NAME
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
BUGS
.IP \(bu
SEE ALSO
.IP \(bu
COPYRIGHT
.IP \(bu
AUTHOR
.LP
|