pnmtopng
Updated: June 2002
Index
NAME
pnmtopng - convert a PNM image to PNG
SYNOPSIS
pnmtopng
[-verbose]
[-downscale]
[-interlace]
[-alpha file]
[-transparent [=]color]
[-background color]
[-palette palettefile]
[-gamma value]
[-hist]
[-chroma wx wy rx ry gx gy bx by]
[-phys x y unit]
[-text file]
[-ztxt file]
[-time [yy]yy-mm-dd
hh:mm:ss]
[-filter type]
[-compression level]
[-force]
[pnmfile]
DESCRIPTION
Reads a PPM, PGM, or PBM image as input. Produces a PNG image as
output.
Color values in PNG files are either eight or sixteen bits wide, so
pnmtopng 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 pnmdepth step is not necessary.
OPTIONS
- -verbose
-
Display the format of the output file.
- -downscale
-
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.
- -interlace
-
Creates an interlaced PNG file (Adam7).
- -alpha file
- This specifies the transparency (alpha channel) of the image.
You supply the alpha channel as a standard PGM alpha mask (see the PGM specification. pnmtopng 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.
pnmtopng even sorts the palette so it can omit the opaque colors
from the transparency part of the palette and save space for the palette.
- -transparent color
-
pnmtopng marks the specified color as transparent in the PNG image.
You specify the color as in ppmmake.E.g. red or
rgb:ff/00/0d. If the color you specify is not present in the
image, pnmtopng 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, pnmtopng chooses one of them arbitrarily.
However, if you prefix your color specification with
"=", e.g.
-transparent =red
only the exact color you specify will be transparent. If that
color does not appear in the image, there will be no transparency.
pnmtopng issues an information message when this is the case.
- -background color
-
Causes pnmtopng to create a background color chunk in the PNG output
which can be used for subsequent alpha channel or transparent color
conversions. Specify color the same as for -transparent.
- -palette palettefile
- This option specifies a palette to use in the PNG. It forces
pnmtopng to create the paletted (colormapped) variety of PNG --
if that isn't possible, pnmtopng fails. If the palette you
specify doesn't contain exactly the colors in the image,
pnmtopng fails. Since pnmtopng will automatically
generate a paletted PNG, with a correct palette, when appropriate, the
only reason you would specify the -palette 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.
You specify the palette by naming a PPM file that has one pixel for each
color in the palette.
If you have a palette and you want to make sure your PNG contains only colors
from the palette, approximating if necessary, pass the Netpbm input image
and your palette PPM through pnmremap. There's no need to use
-palette on pnmtopng in this case. It doesn't save
pnmtopng any work.
- -gamma value
- Causes pnmtopng to create an 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 -gamma .45. 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.
- -hist
- Use this parameter to create a chunk that specifies the frequency
(or histogram) of the colors in the image.
- -chroma white point X and Y, red X and Y, green X and Y,
and blue X and Y
- This option specifies the white point and rgb values following
the CIE-1931 spec.
- -phys x y unit
- When your image should not be displayed with square but with
rectangular pixels, use this option to create a pHYS chunk. When
unit is 0, x and y give only the ratio of pixel
width and height. When it is 1, x and y specify the
number of pixels per meter.
- -text file
-
This option lets you include comments in the text chunk of the PNG output.
file is the name of a file that contains your text comments.
The format of the file is as follows: When the first column does not
contain a blank or a tab, the first word is considered to be a keyword.
For a keyword to contain spaces, enclose it in double quotes.
When the first character on a line is a blank or tab, the rest of
the line is a new line of the current comment. Initial spaces are not
considered to be part of the comment line.
Here is an example:
Title PNG file
Author your name
Description how to include a text chunk
PNG file
"Creation date" 3-feb-1987
Software pnmtopng
- -ztxt file
- The same as -text, except pnmtopng considers the text compressed.
- -time yy-mm-dd hh:mm:ss
or -time yyyy-mm-dd hh:mm:ss
- 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.
- -filter type
- When the types of filters must be restricted you can specify here
which filter you want to use. Allowed values are: 0 (none), 1 (sub), 2
(up), 3 (avg) and 4 (paeth).
- -compression level
- To explicitly set the compression level of zlib use this
parameter. Select a level between 0 for no compression (maximum speed)
and 9 for maximum compression (minimum speed).
- -force
-
When you specify this, pnmtopng 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.
All options can be abbreviated to their shortest unique prefix.
SEE ALSO
pngtopnm,
pnmremap,
pnmgamma,
pnm
For information on the PNG format, see http://schaik.com/png.
AUTHORS
Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- SEE ALSO
-
- AUTHORS
-