pamtotiff
Convert PAM image to TIFF image
TLDR
Convert a PAM image to a TIFF image
Explicitly specify a compression method for the output file
Always produce a color TIFF image, even if the input image is greyscale
SYNOPSIS
pamtotiff [options] [pamfile]
Reads a PAM image from pamfile (or standard input if not specified) and writes a TIFF image to standard output.
PARAMETERS
-deflate
Use Deflate (ZIP) compression. This is a common and generally effective lossless compression.
-packbits
Use PackBits compression. Often effective for images with large areas of single color.
-lzw
Use LZW compression. A widely supported lossless compression method.
-jpeg
Use JPEG compression. A lossy compression method, suitable for photographic images. Note: Not all TIFF readers support JPEG compressed TIFFs.
-g3
Use CCITT Group 3 fax compression. Primarily for bilevel (black and white) images.
-g4
Use CCITT Group 4 fax compression. More efficient than Group 3 for bilevel images, also primarily for black and white.
-none
Do not use any compression.
-rowsperstrip=N
Set the number of rows per strip in the TIFF file to N. Affects how data is organized internally.
-offset=N
Set the byte offset to the first Image File Directory (IFD) to N. Useful for specific TIFF structures.
-bigendian
Write TIFF data in big-endian byte order.
-littleendian
Write TIFF data in little-endian byte order. This is typically the default for PCs.
-color
Force output to 24-bit RGB color, even if input is grayscale or black and white.
-grayscale
Force output to 8-bit grayscale. Color input will be converted to grayscale.
-blackandwhite
Force output to 1-bit black and white. Color or grayscale input will be thresholded.
-bitrgb
Write 1-bit per component RGB. Requires a 3-channel input.
-bitrgbt
Write 1-bit per component RGB with transparency. Requires a 4-channel input (RGB + alpha).
-alpha
Preserve the alpha channel if present in the input PAM. Output will be RGBA.
-description=string
Set the TIFF ImageDescription tag to string.
-datetime=YYYY:MM:DD HH:MM:SS
Set the TIFF DateTime tag. Format must be exactly as specified.
-scanner=string
Set the TIFF Make tag, often used for scanner models, to string.
-artist=string
Set the TIFF Artist tag to string.
-hostcomputer=string
Set the TIFF HostComputer tag to string.
-copyright=string
Set the TIFF Copyright tag to string.
-documentname=string
Set the TIFF DocumentName tag to string.
-pagename=string
Set the TIFF PageName tag to string.
-pagenumber=M,N
Set the TIFF PageNumber tag, where M is the current page and N is the total number of pages.
-xres=N
Set the horizontal resolution of the image to N pixels per unit.
-yres=N
Set the vertical resolution of the image to N pixels per unit.
-units=N
Set the resolution units (1=No absolute unit, 2=Inch, 3=Centimeter). Must be used with -xres and -yres.
-v
Display verbose information during processing.
-verbose
Display verbose information during processing (alias for -v).
DESCRIPTION
pamtotiff is a utility from the Netpbm package that converts a Portable Arbitrary Map (PAM) image into a Tagged Image File Format (TIFF) file. The PAM format is Netpbm's most versatile image representation, capable of handling various pixel types, including color, grayscale, black-and-white, and images with an alpha channel. pamtotiff provides extensive control over the output TIFF properties, such as compression type (e.g., Deflate, LZW, JPEG, PackBits, Group 3/4 fax, or none), byte order, and various TIFF metadata tags like description, date, and artist. It also allows specifying the output color depth (color, grayscale, or black and white). This command is crucial in workflows where image processing is performed using Netpbm tools, and the final output needs to be in the widely supported TIFF format for archiving, printing, or compatibility with other applications. It can read PAM data from standard input and write TIFF data to standard output, facilitating its use in shell pipelines.
CAVEATS
When using JPEG compression (-jpeg), be aware that the output TIFF file might not be compatible with all older or less robust TIFF readers, as JPEG compression within TIFF is an optional feature. CCITT Group 3 and Group 4 compressions (-g3, -g4) are designed specifically for bilevel (black and white) images; using them with color or grayscale input will result in a binarized output. If your input PAM image is not in a suitable format, you might need to use other Netpbm utilities like anytopam or tifftopam to convert it first. Transparency handling can be complex; ensure the target application supports TIFF with alpha channels if you use the -alpha option.
INPUT AND OUTPUT
By default, pamtotiff reads the PAM image data from standard input if no pamfile argument is provided. The resulting TIFF image is always written to standard output. This behavior makes it highly effective for use in shell pipelines, allowing it to seamlessly integrate with other commands that output PAM data or consume TIFF data.
INTEGRATION WITH NETPBM
As a member of the Netpbm family, pamtotiff is designed to work in conjunction with other Netpbm utilities. You can often pipe the output of an image processing command (e.g., from pamscale, pamflip) directly into pamtotiff to convert the final processed image to TIFF format. Conversely, you might use anytopam or tifftopam to convert an image to PAM before passing it to other Netpbm manipulators.
HISTORY
pamtotiff is an integral part of the Netpbm image manipulation suite, which originated from the PBMplus toolkit created by Jef Poskanzer in the late 1980s. Netpbm has evolved to become a foundational set of command-line tools for image conversion and processing on Unix-like systems. The Portable Arbitrary Map (PAM) format itself was introduced into Netpbm to provide a more flexible and generalized image format than the older PBM, PGM, and PPM formats, allowing for features like arbitrary sample depths and alpha channels. pamtotiff was developed to bridge this powerful internal PAM representation with the widely used and standardized TIFF format, supporting a variety of TIFF features and compression methods to meet diverse output requirements. Its design emphasizes pipeline compatibility, a core philosophy of the Netpbm project.