LinuxCommandLibrary

pamtotiff

Convert PAM image to TIFF image

TLDR

Convert a PAM image to a TIFF image

$ pamtotiff [path/to/input_file.pam] > [path/to/output_file.tiff]
copy

Explicitly specify a compression method for the output file
$ pamtotiff -[none|packbits|lzw|g3|g4|flate|adobeflate] [path/to/input_file.pam] > [path/to/output_file.tiff]
copy

Always produce a color TIFF image, even if the input image is greyscale
$ pamtotiff [[-c|-color]] [path/to/input_file.pam] > [path/to/output_file.tiff]
copy

SYNOPSIS

pamtotiff [-tiffalpha] [-planar] [-zcompression] [pamfile]

PARAMETERS

-tiffalpha
    Include PAM alpha as TIFF ExtraSample transparency mask (inverted: PAM opaque=TIFF transparent).

-planar
    Output planar TIFF (type 2: separate R/G/B planes; limited software support).

-z
    Compression type: 0=none, 1=CCITT1D, 2=CCITT2D, 3=T4, 4=T6, 5=LZW, 6=JPEG, 7=ZIP, 8=Deflate.

DESCRIPTION

pamtotiff is a Netpbm utility that reads a PAM (Portable AnyMap) image from standard input or a file and outputs it in TIFF format to standard output. PAM supports arbitrary bit depths, color spaces, and alpha channels, making it ideal for flexible image processing. TIFF offers broad compatibility with compression options and metadata.

By default, it produces an interleaved RGB image plane, discarding alpha and using no compression. Key features include optional alpha channel export as a TIFF transparency mask (with inverted logic: PAM opaque becomes TIFF transparent), planar RGB separation for specialized uses, and eight compression types from none to JPEG or ZIP.

pamtotiff auto-converts other Netpbm formats (PNM) to PAM on input. It's designed for scripting and pipelines, e.g., pnmtopam input.pnm | pamtotiff -z5 > output.tif. Limitations include single-image output and endianness fixed to little-endian in some builds, but TIFF readers handle it well.

CAVEATS

Planar mode unsupported by many TIFF readers.
Alpha inversion may confuse workflows.
Compression suitability varies (e.g., CCITT for monochrome only).
Single image per file; no multi-page TIFF.

INPUT HANDLING

Reads stdin if no file given; auto-converts any Netpbm format (PBM/PGM/PPM/PAM) to PAM.

OUTPUT NOTES

Always stdout (redirect to file); produces standard RGB TIFF unless options specify otherwise.

HISTORY

Introduced in Netpbm 10.24 (June 2004) by Akira F. Matsuda to support PAM alpha/multi-plane features, complementing legacy pnmtotiff.

SEE ALSO

pnmtotiff(1), tifftopnm(1), pam(5), pnm(5), Netpbm(1)

Copied to clipboard