Obsolete options:
[-filter n]
Options available only in older versions:
[-chroma wx wy rx ry gx gy bx by]
[-phys x y unit]
[-time [yy]yy-mm-dd
hh:mm:ss]
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.
This program is part of Netpbm.
pnmtopng reads a PNM image as input and produces a PNG image as output.
Color component 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.
For a grayscale image, pnmtopng produces a PNG bit depth 1, 2, 4, 8 or 16. When the input image has a small maxval, the output PNG image has a correspondingly small bit depth. But in mapping the PNM maxval to the PNG maxval (which is by definition the maximum value that can be represented in the number of bits), a fair amount of distortion happens with these low maxvals. For example, with a PNM maxval of 5 and a PNG maxval of 7, the input sample 2 becomes the output sample 3. The input brightness is 2/5 = .40, while the output brightness is 3/7 = .43. Note that this is not a problem if you view the maxval as a precision, because in .4 and .43 are identical within the precision implied by maxval 5. Indeed, if you convert this PNG back to a maxval 5 PGM, the pixel's value will again be 2, exactly as it was originally. But if you need precisely the same colors in the output PNG as in the input PNM, make sure your input PNM has a maxval which is a power of two minus one. If you can't do that, then convert it with pamdepth to something with a large maxval that is a power of two minus one (255 and 65535 are good choices) to minimize the error.
pnmtopng 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.
Furthermore, the options -chroma, -phys, and -time were replaced by -rgb, -size, and -modtime, respectively. The only difference, taking -phys/-size as an example, is that -phys takes multiple program arguments as the option argument, whereas -size takes a single program argument which is composed of multiple words. E.g. The old shell command
pnmtopng -phys 800 800 0 input.pnm >output.png
is equivalent to the new shell command
pnmtopng -size "800 800 0" input.pnm >output.png
If you're writing a program that needs to work with both new and old pnmtopng, have it first try with the new syntax, and if it fails with "unrecognized option," fall back to the old syntax.
Specify the color (color) as described for the argument of the pnm_parsecolor() library routine. 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.
You specify the palette by naming a PPM file that has one pixel for each color in the palette.
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 -palette. Pass the Netpbm input image and your palette PPM through pnmremap. Though you might think it would, using -palette in this case wouldn't even save pnmtopng any work.
The output contains a distinct tEXt chunk for each entry in the file.
Here is an example of a text string file:
Title PNG file Author John Doe Description how to include a text chunk PNG file "Creation Date" 2015-may-11 Software pamtopng
The file is divided into entries, each entry comprising consecutive lines of text. The first line of an entry starts in the first column (i.e. the first column is not white space) and every other line has white space in the first column. The first entry starts in the first line, so it is not valid for the first line of the file to have white space in its first column.
The first word in an entry is the key of the text string (e.g. "Title"). It begins in column one of the line and continues up to, but not including, the first delimiter character or the end of the line, whichever is first. You can enclose the key in double quotes in which case the key can consists of multiple words. The quotes are not part of the key. The text string per se begins after the key and any delimiter characters after it, plus the text in subsequent continuation lines.
There is no limit on the length of a file line or entry or key or text string. There is no limit on the number of entries.
The chroma_list 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.
This information goes into the PNG's cHRM chunk.
In a shell command, make sure you use quotation marks so that the blanks in chroma_list don't make the shell see multiple command arguments.
This option was new in Netpbm 10.30 (October 2005). Before that, the option -chroma does the same thing, but with slightly different syntax.
unit is either 0 or 1. When it is 1, the option specifies the physical resolution of the image in pixels per meter. For example, -size="10000 15000 1" 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.
When unit is 0, that means there is no advice on the absolute physical resolution; just on the ratio of horizontal to vertical physical resolution.
This information goes into the PNG's pHYS chunk.
When you don't specify -size, pnmtopng creates the image with no pHYS chunk, which means square pixels of no absolute resolution.
This option was new in Netpbm 10.30 (October 2005). Before that, the option -phys does the same thing, but with slightly different syntax.
intent is one of:
This option was new in Netpbm 10.71 (June 2015). Before that, pnmtopng never generates an sRGB chunk.
This option was new in Netpbm 10.30 (October 2005). Before that, the option -time does the same thing, but with slightly different syntax.
Use -nofilter, -sub, -up, -avg, and -paeth in current Netpbm.
These options were new with Netpbm 10.22 (April 2004). Before that, you could use the -filter option to specify one permitted row filter type. The default, when you specify no filter options, was the same.
The default is the default of the zlib library.
The default is the default of the zlib library.
This option was new in Netpbm 10.30 (October 2005).
The default is the default of the zlib library.
This option was new in Netpbm 10.30 (October 2005).
The default is the default of the zlib library.
This option was new in Netpbm 10.30 (October 2005).
See Zlib documentation for details on what this window size is.
The default is the default of the zlib library.
This option was new in Netpbm 10.30 (October 2005).
The value n is the size of the compressed piece (i.e. the compression buffer) in bytes.
This option was new in Netpbm 10.30 (October 2005).
You can't really use this option in a program that invokes pnmtopng and needs to know which version it is. Its function has changed too much over the history of pnmtopng. The option is good only for human eyes.
For information on the PNG format, see http://schaik.com/png.