LinuxCommandLibrary

sgitopnm

Convert SGI image files to PNM format

TLDR

Convert an SGI image to a PNM file

$ sgitopnm [path/to/input.sgi] > [path/to/output.pnm]
copy

Display information about the SGI file
$ sgitopnm [[-verb|-verbose]] [path/to/input.sgi] > [path/to/output.pnm]
copy

Extract channel n of the SGI file
$ sgitopnm [[-c|-channel]] [n] [path/to/input.sgi] > [path/to/output.pnm]
copy

SYNOPSIS

sgitopnm [-verbose] [sgi_file]

PARAMETERS

-verbose
    Prints descriptive information about the input SGI file to standard error during conversion.

sgi_file
    The path to the SGI image file to be converted. If omitted, input is read from standard input (stdin).

DESCRIPTION

sgitopnm is a Linux command-line utility used to convert SGI (Silicon Graphics Image) files into the portable Netpbm image formats. Depending on the input SGI file's content, it generates a PBM (Portable BitMap), PGM (Portable GreyMap), or PPM (Portable PixMap) file.

If the SGI file contains a single-plane image (greyscale or black and white), it produces a PGM or PBM file. For three-plane (color) or four-plane (color with alpha) SGI images, sgitopnm outputs a PPM file, discarding the alpha channel if present. The command supports both uncompressed and RLE-compressed SGI image files. Input can be specified as a file argument or read from standard input. The Netpbm formats are widely used as an intermediate format for various image processing tasks.

CAVEATS

Only a subset of SGI image file formats are supported; colormapped images or those with more than four planes are not handled.
The fourth (alpha) plane, if present in a four-plane SGI image, is discarded during conversion.

OUTPUT FORMAT DETERMINATION

The output Netpbm format (PBM, PGM, or PPM) is automatically determined by sgitopnm based on the number of planes in the input SGI file.
Single-plane SGI images yield PBM/PGM, while multi-plane SGI images (3 or 4 planes) result in PPM output.

HISTORY

sgitopnm is a component of the Netpbm package, a toolkit for manipulating graphic images. Netpbm originated from Pbmplus, created by Jef Poskanzer in 1988, which provided basic tools for portable bitmaps. Over the years, the project expanded to include grey maps and pixel maps, and numerous conversion utilities like sgitopnm were developed to integrate various image formats into the Netpbm ecosystem, allowing for seamless interoperability and processing using the command-line tools.

SEE ALSO

pbm(5), pgm(5), ppm(5), pnm(5), anytopnm(1)

Copied to clipboard