LinuxCommandLibrary

gemtopnm

Convert GEM image files to PNM images

TLDR

Convert a GEM image file to a PNM image

$ gemtopnm [path/to/file.img] > [path/to/output.pnm]
copy

Describe the contents of the specified GEM image
$ gemtopnm [[-d|-debug]] [path/to/file.img]
copy

Display version
$ gemtopnm -version
copy

SYNOPSIS

gemtopnm [gemfile]

DESCRIPTION

gemtopnm is a utility from the Netpbm graphics toolkit that converts GEM Raster (GEM) image files—originally used by Digital Research's GEM environment and Ventura Publisher desktop publishing software—into portable anymap (PNM) formats: PBM for monochrome, PGM for grayscale, or PPM for color images.

The command reads the input GEM file (or standard input if unspecified) and analyzes its header to determine dimensions, bit depth, and color mode. GEM files store images in modes like 1-bit monochrome, 4-bit or 8-bit grayscale, or 24-bit RGB color. The output matches the input type for optimal fidelity, with pixels starting at the top-left corner without margins.

Since GEM lacks a reliable magic number or MIME type, gemtopnm uses heuristics based on file contents for format detection, which can occasionally fail on ambiguous files. In such cases, it outputs an error like "Unable to determine GEM file type." The tool produces raw PNM without headers unless piped to other Netpbm utilities.

Ideal for migrating legacy 1980s/1990s DTP artwork to modern workflows, it integrates seamlessly with Netpbm's converters like pnmtopng or ppmtoggif for further processing.

CAVEATS

No options available. Format detection is heuristic-based and may fail on non-standard GEM files; try gemtopbm(1) instead. Output has no margins—image starts at top-left corner. Supports GEM modes: 1-bit mono, 4/8-bit gray, 24-bit color.

INPUT/OUTPUT BEHAVIOR

Reads gemfile or stdin; always writes raw PNM to stdout. Use redirection or piping, e.g., gemtopnm image.gem > image.ppm.

SUPPORTED GEM VARIANTS

Handles Ventura Publisher GEM and Digital Research GEM Raster; ignores non-image GEM data.

HISTORY

Developed by Jef Poskanzer in 1991 as part of the early Netpbm suite (started 1988). Netpbm evolved into a standard open-source image processing library, with gemtopnm maintaining support for legacy GEM format in versions up to modern releases.

SEE ALSO

gemtopbm(1), giftoppm(1), pbmtoxbm(1), xbmtopbm(1), pbm(5), pgm(5), ppm(5)

Copied to clipboard