.TL
Pnmtopng User Manual
.SH 1
pnmtopng
.LP
Updated: June 2002
.br
Table Of Contents
.SH 2
NAME
.LP
pnmtopng - convert a PNM image to PNG
.SH 2
SYNOPSIS
.LP
\fBpnmtopng\fR
[\fB-verbose\fR]
[\fB-downscale\fR]
[\fB-interlace\fR]
[\fB-alpha=\fR\fIfile\fR]
[\fB-transparent=\fR[\fB=\fR]\fIcolor\fR]
[\fB-background=\fR\fIcolor\fR]
[\fB-palette=\fR\fIpalettefile\fR]
[\fB-gamma=\fR\fIvalue\fR]
[\fB-hist\fR]
[\fB-text=\fR\fIfile\fR]
[\fB-ztxt=\fR\fIfile\fR]
.br
[\fB-rgb="\fR\fIwx\fR \fIwy\fR
\fIrx\fR \fIry\fR \fIgx\fR \fIgy\fR \fIbx\fR \fIby\fR\fB"\fR]
[\fB-size="\fR\fIx\fR \fIy\fR \fIunit\fR\fB"\fR]
[\fB-modtime="\fR[\fIyy\fR]\fIyy\fR\fB-\fR\fImm\fR\fB-\fR\fIdd\fR
\fIhh\fR\fB:\fR\fImm\fR\fB:\fR\fIss\fR\fB"\fR]
[\fB-nofilter\fR]
[\fB-sub\fR]
[\fB-up\fR]
[\fB-avg\fR]
[\fB-paeth\fR]
[\fB-compression=\fR\fIn\fR]
[\fB-comp_mem_level=\fR\fIn\fR]
.br
[\fB-comp_strategy=\fR{\fBhuffman_only\fR|\fBfiltered\fR}]
[\fB-comp_method=\fR\fBdeflated\fR]
[\fB-comp_window_bits=\fR\fIn\fR]
[\fB-comp_buffer_size=\fR\fIn\fR]
[\fB-force\fR]
[\fB-libversion\fR]
[\fIpnmfile\fR]
<?makeman .SH OPTION USAGE ?>
.LP
Obsolete options:
.LP
[\fB-filter \fR\fIn\fR]
.LP
Options available only in older versions:
.LP
[\fB-chroma\fR \fIwx wy rx ry gx gy bx by\fR]
[\fB-phys\fR \fIx\fR \fIy\fR \fIunit\fR]
.br
[\fB-time \fR[\fIyy\fR]\fIyy\fR\fB-\fR\fImm\fR\fB-\fR\fIdd\fR
\fIhh\fR\fB:\fR\fImm\fR\fB:\fR\fIss\fR]
.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
\fBpnmtopng\fR reads a PNM image as input and produces a PNG image as
output.
.LP
Color values in PNG files are either eight or sixteen bits wide, so
\fIpnmtopng\fR will automatically scale colors to have a maxval of
255 or 65535. Grayscale files will be produced with bit depths 1, 2,
4, 8 or 16. An extra \fBpamdepth\fR step is not necessary.
.SH 2
OPTIONS
.LP
.LP
\fBpnmtopng\fR changed in Netpbm 10.30 (October 2005) to use the
standard Netpbm command line syntax. Before that, you could not
use double hyphens to denote an option and could not use an equal
sign to separate an option name from its value. And the options had
to come before the non-option program arguments.
.LP
Furthermore, the options \fB-chroma\fR, \fB-phys\fR, and
\fB-time\fR were replaced by \fB-rgb\fR, \fBsize\fR, and
\fB-modtime\fR, respectively. The only difference, taking
\fB-phys\fR/\fB-size\fR as an example, is that \fB-phys\fR takes
multiple program arguments as the option argument, whereas \fB-rgb\fR
takes a single program argument which is composed of multiple words.
E.g. The old shell command
.DS L
\f(CW pnmtopng -phys 800 800 0 input.pnm >output.png
\fR.DE
.LP
is equivalent to the new shell command
.DS L
\f(CW pnmtopng -size "800 800 0" input.pnm >output.png
\fR.DE
.LP
If you're writing a program that needs to work with both new and old
\fBpnmtopng\fR, have it first try with the new syntax, and if it fails
with "unrecognized option," fall back to the old syntax.
.RS
.IP "\fB-verbose\fR"
Display the format of the output file.
.IP "\fB-downscale\fR"
Enables scaling of maxvalues of more then 65535 to 16 bit. Since
this means loss of image data, the step is not performed by default.
.IP "\fB-interlace\fR"
Creates an interlaced PNG file (Adam7).
.IP "\fB-alpha=\fR\fIfilename\fR"
This specifies the transparency (alpha channel) of the image.
You supply the alpha channel as a standard PGM alpha mask (see the PGM specification. \fBpnmtopng\fR does not
necessarily represents the transparency information as an alpha channel in
the PNG format. If it can represent the transparency information through
a palette, it will do so in order to make a smaller PNG file.
\fBpnmtopng\fR even sorts the palette so it can omit the opaque colors
from the transparency part of the palette and save space for the palette.
.IP "\fB-transparent=\fR\fIcolor\fR"
\fBpnmtopng\fR marks the specified color as transparent in the PNG image.
.LP
Specify the color (\fIcolor\fR) as described for the argument of the \fBppm_parsecolor()\fR
library routine.
E.g. \fBred\fR or
\fBrgb:ff/00/0d\fR. If the color you specify is not present in the
image, \fBpnmtopng\fR selects instead the color in the image that is
closest to the one you specify. Closeness is measured as a cartesian
distance between colors in RGB space. If multiple colors are
equidistant, \fBpnmtopng\fR chooses one of them arbitrarily.
.LP
However, if you prefix your color specification with
"=", e.g.
.DS L
-transparent =red
.DE
.LP
only the exact color you specify will be transparent. If that
color does not appear in the image, there will be no transparency.
\fBpnmtopng\fR issues an information message when this is the case.
.IP "\fB-background=\fR\fIcolor\fR"
Causes \fBpnmtopng\fR to create a background color chunk in the PNG output
which can be used for subsequent alpha channel or transparent color
conversions. Specify \fIcolor\fR the same as for \fB-transparent\fR.
.IP "\fB-palette=\fR\fIpalettefile\fR"
This option specifies a palette to use in the PNG. It forces
\fBpnmtopng\fR to create the paletted (colormapped) variety of PNG --
if that isn't possible, \fBpnmtopng\fR fails. If the palette you
specify doesn't contain exactly the colors in the image,
\fBpnmtopng\fR fails. Since \fBpnmtopng\fR will automatically
generate a paletted PNG, with a correct palette, when appropriate, the
only reason you would specify the \fB-palette\fR option is if you care
in what order the colors appear in the palette. The PNG palette has colors
in the same order as the palette you specify.
.LP
You specify the palette by naming a PPM file that has one pixel for
each color in the palette.
.LP
Alternatively, consider the case that have a palette and you want
to make sure your PNG contains only colors from the palette,
approximating if necessary. You don't care what indexes the PNG uses
internally for the colors (i.e. the order of the PNG palette). In
this case, you don't need \fB-palette\fR. Pass the Netpbm input
image and your palette PPM through \fBpnmremap\fR. Though you might
think it would, using \fB-palette\fR in this case wouldn't even save
\fBpnmtopng\fR any work.
.IP "\fB-gamma=\fR\fIvalue\fR"
Causes \fBpnmtopng\fR to create a gAMA chunk. This information helps
describe how the color values in the PNG must be interpreted. Without
the gAMA chunk, whatever interprets the PNG must get this information
separately (or just assume something standard). If your input is a true
PPM or PGM image, you should specify \fB-gamma .45\fR. But sometimes
people generate images which are ostensibly PPM except the image uses a
different gamma transfer function than the one specified for PPM. A common
case of this is when the image is created by simple hardware that doesn't
have digital computational ability. Also, some simple programs that generate
images from scratch do it with a gamma transfer in which the gamma value is
1.0.
.IP "\fB-hist\fR"
Use this parameter to create a chunk that specifies the frequency
(or histogram) of the colors in the image.
.IP "\fB-rgb=\fR\fIchroma_list\fR"
This option specifies how red, green, and blue component values
of a pixel specify a particular color, by telling the chromaticities
of those 3 primary illuminants and of white (i.e. full strength of
all three).
.LP
The \fIchroma_list\fR value is a blank-separated list of 8 floating
point decimal numbers. The CIE-1931 X and Y chromaticities (in that
order) of each of white, red, green, and blue, in that order.
.LP
This information goes into the PNG's cHRM chunk.
.LP
In a shell command, make sure you use quotation marks so that the
blanks in \fIchroma_list\fR don't make the shell see multiple command
arguments.
.LP
This option was new in Netpbm 10.30 (October 2005). Before that,
the option \fB-chroma\fR does the same thing, but with slightly
different syntax.
.IP "\fB-size="\fR\fIx\fR \fIy\fR \fIunit\fR\fB"\fR"
This option determines the aspect ratio of the individual pixels
of your image as well as the physical resolution of it.
.LP
\fIunit\fR is either \fB0\fR or \fI1\fR. When it is \fI1\fR,
the option specifies the physical resolution of the image in pixels
per meter. For example, \fB-size="10000 15000 1"\fR means
that when someone displays the image, he should make it so that 10,000
pixels horizontally occupy 1 meter and 15,000 pixels vertically occupy
one meter. And even if he doesn't take this advice on the overall
size of the displayed image, he should at least make it so that each
pixel displays as 1.5 times as high as wide.
.LP
When \fIunit\fR is \fB0\fR, that means there is no advice on
the absolute physical resolution; just on the ratio of horizontal to
vertical physical resolution.
.LP
This information goes into the PNG's pHYS chunk.
.LP
When you don't specify \fB-size\fR, \fBpnmtopng\fR creates the image
with no pHYS chunk, which means square pixels of no absolute resolution.
.LP
This option was new in Netpbm 10.30 (October 2005). Before that,
the option \fB-phys\fR does the same thing, but with slightly
different syntax.
.IP "\fB-text=\fR\fIfilename\fR"
This option lets you include comments in the text chunk of the PNG output.
\fIfile\fR is the name of a file that contains your text comments.
.LP
Here is an example of a comment file:
.DS L
Title PNG file
Author Bryan Henderson
Description how to include a text chunk
PNG file
"Creation date" 3-feb-1987
Software pnmtopng
.DE
.LP
The format of the file is as follows: The file is divided into lines,
delimited by newline characters. The last line need not end with a newline
character. A group of consecutive lines represents a comment.
.LP
A "delimiter character" is a blank or tab or null character. The
first line representing a comment must not start with a delimiter
character. Every other line in the group is a "continuation line" and
must start with a delimiter character.
.LP
The first line representing a comment consists of a keyword and the
first line of comment text. The keyword begins in Column 1 of the
file line and continues up to, but not including, the first delimiter
character, or the end of the line, whichever is first. Exception: you
can enclose the keyword in double quotes and spaces and tabs within
the double quotes are part of the keyword. The quotes are not part of
the keyword. A NUL character is not allowed in a keyword.
.LP
The first line of the comment text is all the text in the file line
beginning after the keyword and any delimiter characters after it.
immediately after the delimiter character that marks the end of the
keyword.
.LP
A continuation line defines a subsequent line of the comment. The
comment line is all the text on the continuation line starting with the
first non-delimiter character.
.LP
There is one newline character between every two comment lines. There
is no newline character after the last line of comment text.
.LP
There is no limit on the length of a file line or keyword or comment text
line or comment text. There is no limit on the number of comments or
size of or number of lines in the file.
.IP "\fB-ztxt=\fR\fIfilename\fR"
The same as \fB-text\fR, except \fBpnmtopng\fR considers the
text compressed.
.IP "\fB-modtime="\fR[\fIyy\fR]\fIyy-mm-dd hh:mm:ss\fR\fB"\fR "
This option allows you to specify the modification time value to
be placed in the PNG output. You can specify the year parameter
either as a two digit or four digit value.
.LP
This option was new in Netpbm 10.30 (October 2005). Before that,
the option \fB-time\fR does the same thing, but with slightly
different syntax.
.IP "\fB-filter=\fR\fIn\fR"
This option is obsolete. Before Netpbm 10.22 (April 2004), this was
the only way to specify a row filter. It specifies a single type of
row filter, by number, that \fBpnmtopng\fR must use on each row.
.LP
Use \fB-nofilter\fR, \fB-sub\fR, \fB-up\fR, \fB-avg\fR, and
\fB-paeth\fR in current Netpbm.
.IP "\fB-nofilter\fR"
.IP "\fB-sub\fR"
.IP "\fB-up\fR"
.IP "\fB-avg\fR"
.IP "\fB-paeth\fR"
Each of these options permits \fBpnmtopng\fR to use one type of
row filter. \fBpnmtopng\fR chooses whichever of the permitted
filters it finds to be optimal. If you specify none of these options,
it is the same as specifying all of them -- \fBpnmtopng\fR uses any
row filter type it finds optimal.
.LP
These options were new with Netpbm 10.22 (April 2004). Before that,
you could use the \fB-filter\fR option to specify one permitted row
filter type. The default, when you specify no filter options, was the
same.
.IP "\fB-compression=\fR\fIn\fR"
This option sets set the compression level of the zlib
compression. Select a level from 0 for no compression (maximum speed)
to 9 for maximum compression (minimum speed).
.IP "\fB-comp_mem_level=\fR\fIn\fR"
This option sets the memory usage level of the zlib compression.
Select a level from 1 for minimum memory usage (and minimum speed) to
9 for maximum memory usage (and speed).
.LP
This option was new in Netpbm 10.30 (October 2005).
.IP "\fB-comp_strategy=\fR{\fBhuffman_only\fR|\fBfiltered\fR}"
This options sets the compression strategy of the zlib compression.
See Zlib documentation for information on what these strategies are.
.LP
This option was new in Netpbm 10.30 (October 2005).
.IP "\fB-comp_method=\fR\fBdeflated\fR"
This option does nothing. It is here for mathematical
completeness and for possible forward compatibility. It theoretically
selects the compression method of the zlib compression, but the Z
library knows only one method today, so there's nothing to choose.
.LP
This option was new in Netpbm 10.30 (October 2005).
.IP "\fB-comp_window_bits=\fR\fIN\fR"
This option tells how big a window the zlib compression algorithm
uses. The value is the base 2 logarithm of the window size in bytes,
so 8 means 256 bytes. The value must be from 8 to 15 (i.e. 256 bytes
to 32K).
.LP
See Zlib documentation for details on what this window size is.
.LP
This option was new in Netpbm 10.30 (October 2005).
.IP "\fB-comp_buffer_size\fR=\fIN\fR"
This option determines in what size pieces \fBpnmtopng\fR does the
zlib compression. One compressed piece goes in each IDAT chunk in the
PNG. So the bigger this value, the fewer IDAT chunks your PNG will have.
Theoretically, this makes the PNG smaller because 1) you have less
per-IDAT-chunk overhead, and 2) the compression algorithm has more data
to work with. But in reality, the difference will probably not be
noticeable above about 8K, which is the default.
.LP
The value \fIn\fR is the size of the compressed piece (i.e. the
compression buffer) in bytes.
.LP
This option was new in Netpbm 10.30 (October 2005).
.IP "\fB-force\fR"
When you specify this, \fBpnmtopng\fR limits its optimizations.
The resulting PNG output is as similar to the Netpbm input as possible.
For example, the PNG output will not be paletted and the alpha channel
will be represented as a full alpha channel even if the information could
be represented more succinctly with a transparency chunk.
.IP "\fB-libversion\fR"
This option causes \fBpnmtopng\fR to display version information
about itself and the libraries it uses, in addition to all its
normal function. Do not confuse this with the Netpbm common
option \fB-version\fR, which causes the program to display version
information about the Netpbm library and do nothing else.
.LP
You can't really use this option in a program that invokes
\fBpnmtopng\fR and needs to know which version it is. Its function
has changed too much over the history of \fBpnmtopng\fR. The option
is only good for human eyes.
.RE
.SH 2
SEE ALSO
.LP
pngtopnm,
pamrgbatopng,
pnmremap,
pnmgamma,
pnm
.LP
For information on the PNG format, see http://schaik.com/png.
.SH 2
AUTHORS
.LP
Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
NAME
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
SEE ALSO
.IP \(bu
AUTHORS
.LP
|