Plan 9 from Bell Labs’s /usr/web/sources/contrib/pac/sys/doc/netpbm/ms/pnmtops.ms

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TL
Pnmtops User Manual
.SH 1
pnmtops
.LP
Updated: 10 February 2006
.br
Table Of Contents
.SH 2
NAME
.LP
pnmtops - convert PNM image to PostScript
.SH 2
SYNOPSIS
.LP
\fBpnmtops\fR
[\fB-scale=\fR\fIs\fR]
[\fB-dpi=\fR\fIN\fR[\fBx\fR\fIN\fR]]
[\fB-imagewidth=\fR\fIn\fR]
[\fB-imageheight=\fR\fIn\fR]
[\fB-width=\fR\fIN\fR]
[\fB-height=\fR\fIN\fR]
[\fB-equalpixels\fR]
[\fB-turn\fR|\fB-noturn\fR]
[\fB-rle\fR|\fB-runlength\fR]
[\fB-flate\fR]
[\fB-ascii85\fR]
[\fB-nocenter\fR]
[\fB-nosetpage\fR]
[\fB-level=\fR\fIN\fR]
[\fB-psfilter\fR]
[\fB-noshowpage\fR]
[\fIpnmfile\fR]
.LP
All options can be abbreviated to their shortest unique prefix.
You may use two hyphens instead of one.  You may separate an option
name and its value with white space instead of an equals sign.
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBpnmtops\fR reads a Netpbm image stream as input and produces
Encapsulated PostScript (EPSF) as output.
.LP
If the input file is in color (PPM), \fBpnmtops\fR generates a
color PostScript file.  Some PostScript interpreters can't handle
color PostScript.  If you have one of these you will need to run your
image through \fBppmtopgm\fR first.
.LP
If you specify no output dimensioning options, the output image is
dimensioned as if you had specified \fB-scale=1.0\fR, which means
aproximately 72 pixels of the input image generate one inch of output
(if that fits the page).
.LP
Use \fB-imagewidth\fR, \fB-imageheight\fR, \fB-equalpixels\fR,
\fB-width\fR, \fB-height\fR, and \fB-scale\fR to adjust that.
.LP
Each image in the input stream becomes one complete one-page Postscript 
program in the output.  (This may not be the best way to create a multi-page
Postscript stream; someone who knows Postscript should work on this).
.LP
The line at the top of the file produced by \fBpnmtops\fR is
either "%!PS-Adobe-3.0 EPSF-3.0" or just
"%!PS-Adobe-3.0".  The numbers do not reflect the Postscript
language level, but the version of the DSC comment specification and
EPS specification implmented.  The Postscript language level is in the
"%%LanguageLevel:" comment.  \fBpnmtops\fR omits "EPSF-3.0" if you
specify \fB-setpage\fR, because it is incorrect to claim EPS
compliance if the file uses \fBsetpagedevice\fR.
.SH 3
What is Encapsulated Postscript?
.LP
.LP
Encapsulated Postscript (EPSF) is a subset of Postscript (i.e. the
set of streams that conform to EPSF is a subset of those that conform
to Postscript).  It is designed so that an EPSF stream can be embedded
in another Postscript stream.  A typical reason to do that is where an
EPSF stream describes a picture you want in a larger document.
.LP
An Encapsulated Postscript document conforms to the DSC (Document
Structuring Convention).  The DSC defines some Postscript comments
(they're comments from a Postscript point of view, but have semantic
value from a DSC point of view).
.LP
More information about Encapsulated Postscript is at 
http://www.cs.indiana.edu/docproject/programming/postscript/eps.html.
.LP
Many of the ideas in \fBpnmtops\fR come from Dirk Krause's \fBbmeps\fR.
See SEE ALSO
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-imagewidth\fR, \fB-imageheight\fR"
Tells how wide and high you want the image on the page, in inches.
The aspect ratio of the image is preserved, so if you specify both of these,
the image on the page will be the largest image that will fit within the
box of those dimensions.
.LP
If these dimensions are greater than the page size, you get Postscript
output that runs off the page.
.LP
You cannot use \fBimagewidth\fR or \fBimageheight\fR with
\fB-scale\fR or \fB-equalpixels\fR.
.IP "\fB-equalpixels\fR"
This option causes the output image to have the same number of pixels
as the input image.  So if the output device is 600 dpi and your image
is 3000 pixels wide, the output image would be 5 inches wide.
.LP
You cannot use \fB-equalpixels\fR with \fB-imagewidth\fR,
\fB-imageheight\fR, or \fB-scale\fR.
.IP "\fB-scale\fR"
tells how big you want the image on the page.  The value is the number of
inches of output image that you want 72 pixels of the input to generate.
.LP
But \fBpnmtops \fR rounds the number to something that is an
integral number of output device pixels.  E.g. if the output device is
300 dpi and you specify \fB-scale=1.0\fR, then 75 (not 72) pixels of
input becomes one inch of output (4 output pixels for each input
pixel).  Note that the \fB-dpi\fR option tells \fBpnmtops\fR how
many pixels per inch the output device generates.
.LP
If the size so specified does not fit on the page (as measured
either by the \fB-width\fR and \fB-height\fR options or the default
page size of 8.5 inches by 11 inches), \fBpnmtops\fR ignores the
\fB-scale\fR option, issues a warning, and scales the image to fit on
the page.
.IP "\fB-dpi=\fR\fIN\fR[\fBx\fR\fIN\fR]"
.LP
This option specifies the dots per inch resolution of your output
device.  The default is 300 dpi.  In theory PostScript is
device-independent and you don't have to worry about this, but in
practice its raster rendering can have unsightly bands if the device
pixels and the image pixels aren't in sync.
.LP
Also this option is crucial to the working of the
\fBequalpixels\fR option.
.LP
If you specify \fIN\fR\fBx\fRN, the first number is the
horizontal resolution and the second number is the vertical
resolution.  If you specify just a single number \fIN\fR, that is the
resolution in both directions.
.IP "\fB-width\fR, \fB-height\fR"
 These options specify the dimensions, in inches, of the page on
which the output is to be printed.  This can affect the size of the
output image.
.LP
The page size has no effect, however, when you specify the 
\fB-imagewidth\fR, \fB-imageheight\fR, or \fB-equalpixels\fR options.
.LP
These options may also affect positioning of the image on the page and
even the paper selected (or cut) by the printer/plotter when the
output is printed.  See the \fB-nosetpage\fR option.
.LP
The default is 8.5 inches by 11 inches.
.IP "\fB-turn\fR"
.IP "\fB-noturn\fR "
These options control whether the image gets turned 90 degrees.
Normally, if an image fits the page better when turned (e.g. the image
is wider than it is tall, but the page is taller than it is wide), it
gets turned automatically to better fit the page.  If you specify the
\fB-turn\fR option, \fBpnmtops \fR turns the image no matter what
its shape; If you specify \fB-noturn\fR, \fBpnmtops\fR does
not turn it no matter what its shape.
.IP "\fB-rle\fR"
.IP "\fB-runlength\fR"
These identical options tell \fBpnmtops\fR to use run length
compression in encoding the image in the Postscript program.  This may
save time if the host-to-printer link is slow; but normally the
printer's processing time dominates, so \fB-rle\fR has no effect (and
in the absence of buffering, may make things slower.
.LP
This may, however, make the Postscript program considerable smaller.
.LP
This usually doesn't help at all with a color image and
\fB-psfilter\fR, because in that case, the Postscript program
\fBpnmtops\fR creates has the red, green, and blue values for each
pixel together, which means you would see long runs of identical bytes
only in the unlikely event that the red, green, and blue values for a
bunch of adjacent pixels are all the same.  But without
\fB-psfilter\fR, the Postscript program has all the red values, then
all the green values, then all the blue values, so long runs appear
wherever there are long stretches of the same color.
.IP "\fB-flate\fR"
This option tells \fBpnmtops\fR to use "flate"
compression (i.e. compression via the "Z" library -- the
same as PNG).
.LP
See the \fB-rle\fR option for information about compression in general.
.LP
You must specify \fB-psfilter\fR if you specify \fB-flate\fR.
.LP
This option was new in Netbpm 10.27 (March 2005).
.LP
Before Netpbm 10.32 (February 2005), you could not specify \fB-rle\fR
and \fB-flate\fR together.
.IP "\fB-ascii85\fR"
By default, \fBpnmtops\fR uses "asciihex" encoding of
the image raster.  The image raster is a stream of bits, while a Postscript
program is text, so there has to be an encoding from bits to text.  Asciihex
encoding is just the common hexadecimal representation of bits.  E.g. 8
1 bits would be encoded as the two characters "FF".
.LP
With the \fB-ascii85\fR option, \fBpnmtops\fR uses
"ascii85" encoding instead.  This is an encoding in which 32
bits are encoded into five characters of text.  Thus, it produces less
text for the same raster than asciihex.  But ascii85 is not available
in Postscript Level 1, whereas asciihex is.
.LP
This option was new in Netbpm 10.27 (March 2005).
.IP "\fB-psfilter\fR"
\fBpnmtops\fR can generate two different kinds of Encapsulated
Postscript programs to represent an image.  By default, it generates a
program that redefines \fBreadstring\fR in a custom manner and
doesn't rely on any built-in Postscript filters.  But with the
\fB-psfilter\fR option, \fBpnmtops\fR leaves \fBreadstring\fR alone
and uses the built-in Postscript filters \fB/ASCII85Decode\fR,
\fB/ASCIIHexDecode\fR, \fB/RunLengthDecode\fR, and \fB/FlateDecode\fR.
.LP
This option was new in Netbpm 10.27 (March 2005).  Before that, 
\fBpnmtops\fR always used the custom \fBreadstring\fR.
.LP
The custom code can't do flate or ascii85 encoding, so you must use
\fB-psfilter\fR if you want those (see \fB-flate\fR, \fB-ascii85\fR).
.IP "\fB-level\fR"
This option determines the level (version number) of Postscript that
\fBpnmtops\fR uses.  By default, \fBpnmtops\fR uses Level 2.  Some
features of \fBpnmtops\fR are available only in higher Postscript levels,
so if you specify too low a level for your image and your options,
\fBpnmtops\fR fails.  For example, \fBpnmtops\fR cannot do a color image
in Level 1.
.LP
This option was new in Netpbm 10.27 (March 2005).  Before that,
\fBpnmtops\fR always used Level 2.
.IP "\fB-dict\fR"
This causes the Postscript program create a separated dictionary
for its local variables and remove it from the stack as it exits.
.LP
This option was new in Netbpm 10.27 (March 2005).
.IP "\fB-vmreclaim\fR"
This option causes the Postscript program to force a memory garbage
collection as it exits.
.LP
This option was new in Netbpm 10.27 (March 2005).
.IP "\fB-nocenter\fR"
By default, \fBpnmtops\fR centers the image on the output page.
You can cause \fBpnmtops\fR to instead put the image against the
lower left corner of the page with the \fB-nocenter \fR
option.  This is useful for programs which can include
PostScript files, but can't cope with pictures which are not
positioned in the lower left corner.
.LP
For backward compatibility, \fBpnmtops\fR accepts the option
\fB-center\fR, but it has no effect.
.IP "\fB-setpage\fR"
This causes \fBpnmtops\fR to include a "setpagedevice"
directive in the output.  This causes the output to violate specifications
of EPSF encapsulated Postscript, but if you're not using it in an
encapsulated way, may be what you need.  The directive tells the
printer/plotter what size paper to use (or cut).  The dimensions it
specifies on this directive are those selected by the
\fB-width\fR and \fB-height\fR options or defaulted.
.LP
From January through May 2002, the default was to include
"setpagedevice" and this option did not exist.  Before
January 2002, there was no way to include "setpagedevice"
and neither the \fB-setpage\fR nor \fB-nosetpage\fR option existed.
.IP "\fB-nosetpage\fR"
This tells \fBpnmtops\fR not to include a "setpagedevice"
directive in the output.  This is the default, so the option has no
effect.
.LP
See the \fB-setpage\fR option for the history of this option.
.IP "\fB-noshowpage\fR"
This tells \fBpnmtops\fR not to include a "showpage"
directive in the output.  By default, \fBpnmtops\fR includes a
"showpage" at the end of the EPSF program  According to
EPSF specs, this is OK, and the program that includes the EPSF is
supposed to redefine showpage so this doesn't cause undesirable
behavior.  But it's often easier just not to have the showpage.
.LP
This options was new in Netpbm 10.27 (March 2005).  Earlier
versions of \fBpnmtops\fR always include the showpage.
.IP "\fB-showpage\fR"
This tells \fBpnmtops\fR to include a "showpage" directive
at the end of the EPSF output.  This is the default, so the option has
no effect.
.LP
This option was new in Netpbm 10.27 (March 2005).
.RE
.SH 2
LIMITATIONS
.LP
.LP
If the PNM image has a maxval greater than 255, \fBpnmtops\fR will
probably produce incorrect output unless you use the \fB-psfilter\fR
option or use the \fB-level\fR option to demand Postscript Level 1.
.SH 2
SEE ALSO
.LP
.LP
Postscript is described in the Postscript
Language Reference Manual.
.LP
\fBbmeps\fR converts
from Netpbm and other formats to Encapsulated Postscript.  It is suitable
for hooking up to \fBdvips\fR so you can include an image in a Latex
document just with an \includegraphics directive.
\fBbmeps\fR has a few functions \fBpnmtops\fR does not, such as the ability
to include a transparency mask in the Postscript program (but not from PAM
input -- only from PNG input).
.LP
\fBpnm\fR,
\fBgs\fR,
\fBpsidtopgm\fR,
\fBpstopnm\fR,
\fBpbmtolps\fR,
\fBpbmtoepsi\fR,
\fBpbmtopsg3\fR,
\fBppmtopgm\fR,
.SH 2
AUTHOR
.LP
.LP
Copyright (C) 1989, 1991 by Jef Poskanzer.
.LP
Modified November 1993 by Wolfgang Stuerzlinger, wrzl@gup.uni-linz.ac.at
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
NAME
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
LIMITATIONS
.IP \(bu
SEE ALSO
.IP \(bu
AUTHOR
.LP

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.