LinuxCommandLibrary

pamedge

Detect edges in a Netpbm image

TLDR

Perform edge-detection on a Netpbm image

$ pamedge [path/to/input.pam] > [path/to/output.pam]
copy

SYNOPSIS

pamedge [-sobel|-prewitt|-roberts|-laplacian|-simple|-none] [-horiz|-vert|-diag|-all|-none] [-width=N] [-height=N] [-maxval=N] [-verbose] [netpbmfile]

PARAMETERS

-sobel
    Uses the Sobel 3x3 edge detection mask, emphasizing stronger edges.

-prewitt
    Uses the Prewitt 3x3 edge detection mask, similar to Sobel but simpler.

-roberts
    Uses the Roberts cross 2x2 edge detection mask, good for fast detection.

-laplacian
    Uses the Laplacian 3x3 edge detection mask, useful for second derivative analysis.

-simple
    Uses a basic 3x3 edge detection mask.

-none
    When used for mask selection, means no edge detection is performed. When used for direction, means no specific direction is emphasized.

-horiz
    Emphasizes horizontal edges in the output image.

-vert
    Emphasizes vertical edges in the output image.

-diag
    Emphasizes diagonal edges in the output image.

-all
    Emphasizes all directional edges. This is often the default behavior if no specific direction is chosen.

-width=N
    Sets the width of the output image to N pixels.

-height=N
    Sets the height of the output image to N pixels.

-maxval=N
    Sets the maximum pixel value (color depth) of the output image to N. By default, it uses the input image's maxval.

-verbose
    Prints detailed information about the processing steps and image characteristics to standard error.

netpbmfile
    The path to the input Netpbm format image file. If omitted, pamedge reads from standard input.

DESCRIPTION

pamedge is a command-line utility from the Netpbm toolkit designed to detect and highlight edges within an image. It primarily operates on PAM (Portable Arbitrary Map) format images but can also process other Netpbm formats such as PBM (bitmap), PGM (grayscale), and PPM (color) by converting them internally. The command uses various edge detection algorithms, including Sobel, Prewitt, Roberts, and Laplacian, to identify abrupt changes in pixel intensity that typically indicate edges. It reads image data from standard input or a specified file and writes the resulting edge-enhanced image to standard output, adhering to the Netpbm philosophy of chained image processing. This tool is valuable for tasks like feature extraction, image analysis, and preparing images for further graphical manipulation.

CAVEATS

pamedge is primarily designed for grayscale images. While it accepts color (PPM) and bitmap (PBM) inputs, it typically converts them to grayscale internally for edge detection, or processes color components separately. The output maxval might be larger than the input maxval if not explicitly controlled with -maxval, potentially requiring further normalization with other Netpbm tools.

STANDARD I/O USAGE

Following the Unix philosophy, pamedge operates as a filter. It reads image data from standard input if no file argument is provided, and writes the processed image to standard output. This design makes it highly suitable for chaining with other Netpbm commands in pipelines, enabling complex image manipulation workflows.

IMAGE FORMAT CONVERSION

While primarily focused on the PAM format, pamedge intelligently handles other Netpbm image types (PBM, PGM, PPM). It performs internal conversions to an appropriate format for edge detection and outputs the result in a compatible Netpbm format, typically PGM or PAM, depending on the input and processing.

HISTORY

pamedge is an integral part of the Netpbm project, a suite of graphics utilities that evolved from the PBMplus package. Netpbm has a long history in Unix and Linux environments, providing fundamental image processing capabilities. pamedge was developed to specifically handle the more flexible PAM format, extending the existing edge detection functionality within the toolkit and ensuring compatibility with the modern Netpbm suite's unified arbitrary map format.

SEE ALSO

pam(1), pbm(1), pgm(1), ppm(1), pnm(1), pnmsharpen(1), pnmhisteq(1), netpbm(1)

Copied to clipboard