pngtopnm

Updated: 6 January 1997
Table Of Contents  

NAME

pngtopnm - convert a PNG image into a PNM image  

SYNOPSIS

pngtopnm [-verbose] [-alpha | -mix] [-background color]
[-gamma value] [-text file] [-time] [pngfile]  

DESCRIPTION

pngtopnm reads a PNG image (Portable Network Graphics) as input and produces a PPM image as output. The type of the output file depends on the input file - if it's black & white, pngtopnm creates a PBM file. If it's grayscale, pngtopnm creates a PGM file. Otherwise, it creates a PPM file.  

OPTIONS

-verbose
Display various information about the input PNG image and the conversion process.

If you want even more information about the PNG image, use pngcheck (not part of Netpbm).

-alpha
Output the alpha channel or transparency mask of the image. The result is either a PBM file or a PGM file, depending on whether different levels of transparency appear.
-mix
Compose the image with the transparency or alpha mask against a background. When a background chunk is available, pngtopnm uses the color it specifies. Otherwise, pngtopnm uses black.
-background color
If no background color chunck is present in the png-file or when another color is required, you can use this parameter to set the background color of images. This is especially useful for alpha-channel images or those with transparency chunks. The format, to specify the color in, is either (in the case of orange) "1.0,0.5,0.0", where the values are floating point decimal between zero and one, or with the syntax "#RGB", "#RRGGBB" or "#RRRRGGGGBBBB" where R, G and B are hexadecimal numbers.
-gamma value
Converts the image to a new display-gamma value. If a gAMA chunk is present in the png-file, pngtopnm uses the specified image-gamma value. If not, pngtopnm considers the image-gamma to be 1.0. Based on the image-gamma and the display-gamma given with this option, pngtopnm adjusts the colors written to the pnm-file.

Because the gammas of uncompensated monitors are around 2.6, which results in an image-gamma of 0.45, some typical situations are: when the image-gamma is 0.45 (use -verbose to check) and the picture is too light, your system is gamma-corrected, so convert with "-gamma 1.0". When no gAMA chunk is present or the image-gamma is 1.0, use 2.2 to make the picture lighter and 0.45 to make the picture darker.

-text file
Writes the tEXt and zTXt chunks to a file, in a format as described in the pnmtopng user manual. These chunks contain text comments or annotations.
-time
Prints the tIME chunk to stderr.

All options can be abbreviated to their shortest unique prefix.  

SEE ALSO

pnmtopng, ptot, pnmgamma, pnm

For information on the PNG format, see http://schaik.com/png.  

NOTE

A PNG image contains a lot of information that can't be represented in Netpbm formats. Therefore, you lose information when you convert to another format with "pngtopnm | pnmtoxxx". If there is a specialized converter that converts directly to the other format, e.g. ptot to convert from PNG to TIFF, you'll get better results using that.  

LIMITATIONS

There could be an option to read the comment text from pnm comments instead of a separate file.

The program could be much faster, with a bit of code optimizing. As with any Netpbm program, speed always takes a back seat to quick present and future development.  

AUTHORS

Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
 

Table Of Contents