Obsolete options:
[-filter type]
You may abbreviate any option to its shortest unique prefix.
This program is part of Netpbm.
pnmtopng reads a PNM image as input and 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.
Specify the color (color) as described for the argument of the ppm_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.
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, -phys 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 -phys, pnmtopng creates the image with no pHYS chunk, which means square pixels of no absolute resolution.
Here is an example of a comment file:
Title PNG file Author Bryan Henderson Description how to include a text chunk PNG file "Creation date" 3-feb-1987 Software pnmtopng
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.
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.
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.
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.
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.
There is one newline character between every two comment lines. There is no newline character after the last line of comment text.
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.
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.
For information on the PNG format, see http://schaik.com/png.