LinuxCommandLibrary

pamtopnm

Convert PAM image files to PNM

TLDR

Convert a PAM image to an equivalent PNM image, i.e. a PBM, PGM or PPM image

$ pamtopnm [path/to/image.pam] > [path/to/output.pbm|pgm|ppm]
copy

Display version
$ pamtopnm [[-v|-version]]
copy

SYNOPSIS

pamtopnm [pamfile]

PARAMETERS

pamfile
    The input PAM file. If not specified, standard input is used.

DESCRIPTION

The pamtopnm command converts a PAM (Portable Arbitrary Map) image to a PBM (Portable Bitmap), PGM (Portable Graymap), or PPM (Portable Pixmap) image, depending on the PAM's tuple type and maxval.

Specifically: If the PAM is black and white, it's converted to PBM. If it's grayscale, it's converted to PGM. Otherwise it is converted to PPM. The command is useful for processing PAM images with tools that only support PBM, PGM, or PPM formats. It offers no options for controlling the conversion process beyond the input and output file specifications. The resulting PBM, PGM or PPM files are written to standard output unless an output file is specified.

EXIT STATUS

pamtopnm exits with 0 if successful. Otherwise, it exits with a non-zero value.

EXAMPLES

Convert a PAM file named 'image.pam' to PGM and save it as 'image.pgm':
pamtopnm image.pam > image.pgm
Convert a PAM image received from standard input to PPM and save it to 'image.ppm':
cat image.pam | pamtopnm > image.ppm

HISTORY

The pamtopnm command is part of the Netpbm graphics package. The Netpbm package has been around since 1988, providing a set of tools for manipulating bitmap images. pamtopnm specifically provides a means to easily convert the newer PAM format into the older formats. The program's development has been influenced by the need to process PAM images with a variety of image processing tools.

SEE ALSO

pnmtopam(1), pbm(5), pgm(5), ppm(5), pam(5)

Copied to clipboard