pnmtorast
Convert PNM images to Sun raster format
TLDR
Convert a PNM image to a RAST image
Force either RT_STANDARD or RT_BYTE_ENCODED form for the output
SYNOPSIS
pnmtorast [-std_rle] [-overall_width=N] [-overall_height=N] [-force_indexed] [pnmfile]
PARAMETERS
-std_rle
Produces an old-style RLE compressed rasterfile instead of a new-style one.
-overall_width=N
Sets the output rasterfile width to N pixels, padding with black if the input is smaller.
-overall_height=N
Sets the output rasterfile height to N pixels, padding with black if the input is smaller.
-force_indexed
Forces the output to be an 8-bit indexed color rasterfile, even for direct color input.
pnmfile
The PNM input file. If omitted, input is read from standard input.
DESCRIPTION
pnmtorast converts a Portable Anymap (PNM) image file (PBM, PGM, or PPM) into a Sun Rasterfile. It reads the PNM input from a specified file or standard input and writes the Sun Rasterfile output to standard output. The command intelligently selects the most appropriate Sun Rasterfile variant based on the input PNM type, for example, generating monochrome for PBM or 24-bit direct color for PPM. It can also be forced to produce specific rasterfile types like 8-bit indexed color.
CAVEATS
The Sun Rasterfile format has multiple variants; pnmtorast chooses the most appropriate one automatically. Explicit options may override this. Output is always sent to standard output. Using -overall_width or -overall_height will pad the image with black if the original is smaller.
INPUT/OUTPUT BEHAVIOR
pnmtorast reads its PNM input from the file specified on the command line, or from standard input if no file is given. It always writes the resulting Sun Rasterfile to standard output.
HISTORY
pnmtorast is a component of the Netpbm project, a long-established toolkit for graphics manipulation. Its development and usage are intertwined with the history of Netpbm, providing robust image format conversions for decades.