LinuxCommandLibrary

pgmtoppm

converts a PGM grayscale image to a PPM color image

TLDR

Convert grayscale to color

$ pgmtoppm [color] [input.pgm] > [output.ppm]
copy
Colorize with specific color
$ pgmtoppm [red] [input.pgm] > [output.ppm]
copy
Map black-white to color range
$ pgmtoppm [black]-[blue] [input.pgm] > [output.ppm]
copy
Use color map file
$ pgmtoppm -map [colormap.ppm] [input.pgm] > [output.ppm]
copy

SYNOPSIS

pgmtoppm colorspec [pgmfile]
pgmtoppm -map mapfile [pgmfile]

DESCRIPTION

pgmtoppm converts a PGM grayscale image to a PPM color image. It maps gray values to colors, either a single color, a color range, or via a colormap.

PARAMETERS

colorspec

Color name or black-white range (e.g., "red", "black-blue").
-map file
Color map file.

Grayscale to red tint

pgmtoppm red image.pgm > red.ppm

Map to blue gradient

pgmtoppm black-blue image.pgm > blue.ppm

Heat map style

pgmtoppm blue-red image.pgm > heat.ppm

Using hex colors

pgmtoppm "#000000-#ff5500" image.pgm > orange.ppm

From color map

pgmtoppm -map palette.ppm image.pgm > colored.ppm

$
# COLOR FORMATS
copy
Color names: red, blue, green, yellow...
Hex: #rrggbb
RGB: rgb:rr/gg/bb
Range: color1-color2
$
# CAVEATS

Input must be PGM. For the reverse, use ppmtopgm. Part of Netpbm toolkit.

# HISTORY

pgmtoppm is part of **Netpbm** by **Jef Poskanzer**, providing grayscale to color conversion.

# SEE ALSO

ppmtopgm(1), pgmramp(1), ppmchange(1), netpbm(1)
copy

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community