LinuxCommandLibrary

pgmedge

Manage edge nodes using PostgreSQL

TLDR

View documentation for the current command

$ tldr pamedge
copy

SYNOPSIS

pgmedge [-tthreshold] [-wwidth] [-v] [-s] [-S] [-d] [-D] [pgmfile]

PARAMETERS

-tthreshold
    Min difference for edge pixel (0-255). Default: 10.

-wwidth
    Edge line thickness (≥1). Default: 1.

-v
    Invert: white edges on black background.

-s
    Simple edges: 1-pixel horizontal/vertical offsets.

-S
    Sobel operator for edge detection.

-d
    Darker edges (vs. default lighter).

-D
    Even darker edges.

DESCRIPTION

pgmedge is a utility from the Netpbm graphics toolkit that detects and highlights edges in grayscale (PGM) images.

It reads a PGM image from standard input or a file, computes gray-level differences between neighboring pixels, and outputs a new PGM image emphasizing edges as bright or dark lines.

Edge detection uses gradient magnitudes: default "fancy" method (Prewitt-style, multi-directional), simple 1-pixel offsets (-s), or Sobel operator (-S). Sensitivity is controlled by a threshold; low differences are ignored. Edge thickness and polarity (light/dark) are adjustable.

Ideal for image analysis, feature extraction, sketch effects, or preprocessing. Integrates seamlessly in pipelines via stdin/stdout. Supports 8-bit PGM only (maxval 255). Example: pgmrotate input.pgm 90 | pgmedge -t15 -w2 -v > edges.pgm.

Produces binary-like edge maps with tunable parameters for precision.

CAVEATS

Requires 8-bit PGM input (grayscale only).
Options like -t/-w take immediate integer args (e.g., -t20).
Default maxval 255 on output; no color support.

ALGORITHMS

Default (fancy): Prewitt-like multi-dir. gradients (2px offsets).
-s: Basic horiz/vert 1px diffs.
-S: Sobel 3x3 kernel.

I/O

Stdin if no pgmfile; stdout always.
Errors on non-PGM input.

HISTORY

Introduced in early PBMPLUS (1988-1991) by Jef Poskanzer.
Integrated into Netpbm suite; stable since version 9.x (2000s). Minimal changes over decades.

SEE ALSO

pgm(5), pnm(5), pgmconvolve(1), pnmtops(1)

Copied to clipboard