pnmtosgi
Convert PNM image to Sun rasterfile image
TLDR
Convert a PNM image to an SGI image
Disable or enable compression
Write the specified string into the SGI image header's imagename field
SYNOPSIS
pnmtosgi [-verbose] [-b|-l] [-c] [-r|-g] [-a|-alpha] [-n] [-h] [-o output_file] [input_file]
PARAMETERS
-verbose
Prints informational messages about the conversion process to standard error.
-b
Forces big-endian byte order in the output SGI file. SGI files are typically big-endian.
-l
Forces little-endian byte order in the output SGI file. SGI image files are typically big-endian, so this option is rarely used.
-c
Stores the image data in CM_RLE (Run Length Encoded) format, which can reduce file size for images with large uniform areas. Default is uncompressed CM_RGB.
-r or -g
Stores the image data in CM_32BIT_RGB format, using 32 bits per pixel for RGB data.
-a or -alpha
Stores the image data in CM_32BIT_ALPHA format, including a 32-bit alpha channel for transparency. This requires the input PNM to provide alpha channel information.
-n
Stores only the SGI header information, with no image data (CM_NODATA).
-h
Stores the image data in CM_SCREEN format, typically 8-bit, which is a display-optimized format.
-o output_file
Specifies the name of the output SGI image file. If omitted, the output is written to standard output.
input_file
Specifies the name of the input PNM image file. If omitted, the input is read from standard input.
DESCRIPTION
pnmtosgi is a utility from the Netpbm image manipulation toolkit. It converts image files in the Portable Anymap (PNM) format (which includes Portable Bitmap - PBM, Portable Graymap - PGM, and Portable Pixmap - PPM) into the SGI (Silicon Graphics Image) format, also known as IRIS RGB. This command is particularly useful for interoperability with older graphics systems or applications that natively support SGI image files. It can handle various SGI storage types, including standard RGB, 32-bit RGB, and 32-bit alpha channels, and can also apply run-length encoding. The input PNM image is read from standard input by default, and the resulting SGI image is written to standard output, unless an output file is specified using the -o option.
CAVEATS
The SGI image format (IRIS RGB) is an older format and is less commonly used today compared to modern formats like PNG or JPEG.
Not all PNM features (e.g., arbitrary color depths) may map perfectly to SGI's fixed depth capabilities, potentially leading to data loss or approximation.
Alpha channel support (-a or -alpha) depends on the input PNM containing an alpha channel (e.g., generated by pamstack or pnmalpha). Otherwise, the alpha channel may be empty or ignored.
The -r and -g options are redundant and both set the output to CM_32BIT_RGB.
NETPBM SUITE
pnmtosgi is one of hundreds of tools in the Netpbm suite. Netpbm commands often operate on standard input/output, allowing them to be easily chained together in pipelines to perform complex image manipulations.
IMAGE INTEROPERABILITY
This command serves as a bridge between the highly flexible PNM format and the specific SGI format, enabling data exchange in environments where the SGI format is required, especially for older or specialized systems.
HISTORY
pnmtosgi is part of the Netpbm project, a long-standing toolkit for graphics manipulation that originated from the Pbmplus package developed in the late 1980s by Jef Poskanzer. The SGI image format itself (IRIS RGB) was developed by Silicon Graphics for their workstations in the 1980s and early 1990s, becoming a common format in professional graphics environments before the widespread adoption of more generic image formats. pnmtosgi was created to facilitate interoperability between the versatile Netpbm suite and systems that relied on SGI's native image format. Its relevance has diminished somewhat with the decline of SGI workstations and the rise of more modern, universally supported image formats, but it remains a valuable tool for legacy systems or specific niche applications.