LinuxCommandLibrary

imgtoppm

Convert image formats to PPM

TLDR

Convert an input image to PPM format

$ imgtoppm [path/to/input] > [path/to/output.ppm]
copy

Display version
$ imgtoppm [[-v|-version]]
copy

SYNOPSIS

imgtoppm [-verbose] [imgfile]

PARAMETERS

-verbose
    Provides verbose output, showing details about the conversion process, such as the detected image type and dimensions.

imgfile
    The path to the input image file to be converted. If this argument is omitted, imgtoppm reads the image data from standard input.

DESCRIPTION

imgtoppm is a utility from the Netpbm project designed to convert image files from several older or less common formats into the Portable PixMap (PPM) format. PPM is a simple, plain-text or binary format for storing pixel-based images, part of the Netpbm suite of graphics manipulation tools.

Specifically, imgtoppm handles formats such as GEM .IMG files (common on Atari ST and Amiga), and PC Paintbrush .IMG files. The Netpbm tools are often used in shell scripts for batch processing or piping image data between different utilities.

While imgtoppm is specialized for specific .IMG variants, the broader anytopnm command or more general tools like ImageMagick's convert are typically used for wider image format conversion. imgtoppm outputs a PPM image to standard output, making it suitable for piping to other Netpbm commands or redirecting to a file.

CAVEATS

imgtoppm is specific to older GEM .IMG and PC Paintbrush .IMG formats. It does not support other common image formats like JPEG, PNG, GIF, or modern TIFF variants. For broader image conversion needs, more versatile tools like anytopnm (also from Netpbm) or convert (from ImageMagick) are generally more suitable. The input file must strictly adhere to one of the supported .IMG variations; otherwise, the command will likely fail with an error indicating an unrecognized or corrupt file.

<I>USAGE WITH PIPELINES</I>

imgtoppm is designed to be used effectively within shell pipelines. It reads the input image file (or standard input) and writes the resulting PPM data to standard output. This design allows its output to be directly piped as input to another Netpbm utility or any command that accepts PPM data on standard input (e.g., ppmtopgm, pnmnoraw, or a display program).

For instance, to convert an .IMG file to a PNG format, you might use a pipeline like:
imgtoppm input.img | ppmtopgm | pnmtopng > output.png

HISTORY

imgtoppm is an integral part of the Netpbm package, a venerable suite of graphics utilities that evolved from Jef Poskanzer's Pbmplus utilities in the late 1980s. The core philosophy of Netpbm emphasizes simple, pipe-friendly tools, each performing a single, specific task efficiently.

imgtoppm was developed to specifically handle the conversion of older GEM .IMG files, which were prevalent on platforms like the Atari ST, and PC Paintbrush .IMG files, common in early DOS environments. Its inclusion reflects the need to integrate these historical image formats into the Netpbm ecosystem, allowing them to be manipulated by other Netpbm tools. While its specific .IMG format support is niche today, it remains a testament to Netpbm's comprehensive approach to image format interoperability and its commitment to preserving access to legacy image data.

SEE ALSO

anytopnm(1), ppm(5), netpbm(1), convert(1)

Copied to clipboard