LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pnmconvol

Apply convolution filters to PNM images

TLDR

Apply convolution matrix
$ pnmconvol [matrix.pgm] [input.pnm] > [output.pnm]
copy
Create blur effect
$ pnmconvol -matrix=[1,1,1;1,1,1;1,1,1] [input.pnm] > [output.pnm]
copy
Edge detection
$ pnmconvol -matrix=[-1,-1,-1;-1,8,-1;-1,-1,-1] [input.pnm] > [output.pnm]
copy

SYNOPSIS

pnmconvol [options] convolution input

DESCRIPTION

pnmconvol applies convolution matrix filters to PNM images for effects like blurring, sharpening, and edge detection. The convolution kernel can be specified as a PGM file or inline with the -matrix option.Each output pixel is computed as the weighted sum of surrounding input pixels according to the kernel values. Part of the Netpbm toolkit for image processing.

PARAMETERS

CONVOLUTION

Convolution matrix as a PGM file.
INPUT
Input PNM image file.
-matrix SPEC
Specify convolution matrix inline (e.g., "1,1,1;1,1,1;1,1,1").
-matrixfile FILE
Read convolution matrix from a file.
-normalize
Scale weights to sum to one, preserving overall image brightness.
-bias n
Amount to add to each convolved sample value, useful for handling negative results.
-nooffset
Normalize matrix values by dividing by maxval instead of using offset calculations.

INSTALL

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

CAVEATS

Part of Netpbm. Matrix defines effect. Slow for large kernels.

HISTORY

pnmconvol is part of Netpbm for convolution operations.

SEE ALSO

pamedge(1), pnmsmooth(1), netpbm(1)

Copied to clipboard
Kai