pgmedge

detects edges in a PGM grayscale image using the Sobel edge detection algorithm

TLDR

Detect edges in image
$ pgmedge [input.pgm] > [output.pgm]
From another format
$ jpegtopnm [image.jpg] | ppmtopgm | pgmedge > [edges.pgm]
Chain with conversion
$ pgmedge [input.pgm] | pnmtopng > [edges.png]

SYNOPSIS

pgmedge [pgmfile]

DESCRIPTION

pgmedge detects edges in a PGM grayscale image using the Sobel edge detection algorithm. Output is a PGM where bright pixels indicate strong edges.The algorithm computes the horizontal and vertical image gradients using Sobel kernels and combines them, producing a single intensity per pixel proportional to the local gradient magnitude.

PARAMETERS

pgmfile

Input PGM file. Uses stdin if not specified.

INSTALL

sudo apt install netpbm
sudo dnf install netpbm
sudo pacman -S netpbm
sudo apk add netpbm
sudo zypper install netpbm
brew install netpbm
nix profile install nixpkgs#netpbm

CAVEATS

Input must be a grayscale PGM. Convert color images with ppmtopgm first. pgmedge is the legacy tool — pamedge offers more options including thresholding and direction output.

HISTORY

pgmedge is part of Netpbm by Jef Poskanzer and contributors, implementing classic image processing algorithms.

SEE ALSO

pamedge(1), pgmenhance(1), ppmtopgm(1), netpbm(1)