pnmtopam
Convert PNM image to PAM image format
SYNOPSIS
pnmtopam [pnmfile]
Input is read from standard input if pnmfile is not specified. Output is written to standard output.
PARAMETERS
-tupletype=
Specifies the tuple type name for the output PAM header. This can describe the semantic meaning of the channels, e.g., RGB, GRAYSCALE, etc.
-alpha
Adds an opaque alpha channel to the output PAM image. The alpha value will be the maximum possible value for the deepness.
-alphaval=
Adds an alpha channel to the output PAM image, setting all alpha values to the specified value. This allows for a uniform transparency.
-verbose
Prints informative messages about the input and output formats, including the maximum value and dimensions.
-forceplain
Forces the output PAM to be in plain (ASCII) format, even if the input was raw (binary). By default, pnmtopam produces raw PAM output.
DESCRIPTION
pnmtopam is a Netpbm utility that converts an image in the Portable Anymap (PNM) format (which includes Portable Bitmap PBM, Portable Graymap PGM, and Portable Pixmap PPM) into the Portable Arbitrary Map (PAM) format. The PAM format is a more general and flexible Netpbm format that can handle an arbitrary number of planes (channels) and arbitrary tuple types.
This command essentially upgrades a classic PNM file to the more modern PAM structure, preserving the image data. It's particularly useful when you need to process images with tools that exclusively work with PAM, or when you intend to add an alpha channel to an existing PNM image, as PAM inherently supports multiple channels beyond the basic RGB.
CAVEATS
pnmtopam primarily performs a format conversion. It does not perform image manipulation or color space conversions beyond what's implied by adding an alpha channel. The output PAM file will have the same dimensions and basic pixel data as the input PNM file.
<I>STANDARD INPUT/OUTPUT</I>
Like most Netpbm commands, pnmtopam is designed to work as a filter in a pipeline. If no input file is specified, it reads from standard input. The converted PAM output is always written to standard output, making it easy to chain with other Netpbm utilities or redirect to a file.
HISTORY
pnmtopam is part of the Netpbm project, a toolkit for graphic file conversion and manipulation. Netpbm originated from Jef Poskanzer's Pbmplus package in the late 1980s. The PAM format was introduced later as a more flexible evolution of the original PNM formats, allowing for arbitrary numbers of image channels and more descriptive headers. pnmtopam was developed to bridge the gap, enabling older PNM files to be integrated into workflows that utilize the more powerful PAM format.