LinuxCommandLibrary

pgmcrater

Convert between PGM image file formats

TLDR

View documentation for pamcrater

$ tldr pamcrater
copy

View documentation for pamshadedrelief
$ tldr pamshadedrelief
copy

View documentation for pamtopnm
$ tldr pamtopnm
copy

SYNOPSIS

pgmcrater [-width=pixels] [-height=pixels] [-radius=pixels] [-maxval=value] [-absolute] [-smooth] [-edge=percent] [-depth=value]

PARAMETERS

-width=pixels
    Specifies the width of the generated image in pixels. If omitted, a default width is used (often 256 or derived from height).

-height=pixels
    Specifies the height of the generated image in pixels. If omitted, a default height is used (often 256 or derived from width).

-radius=pixels
    Sets the radius of the crater in pixels. If not specified, it defaults to half of the smaller dimension (width or height).

-maxval=value
    Defines the maximum gray value for the PGM image. This value must be between 1 and 65535, inclusive. It defaults to 255, creating an 8-bit image.

-absolute
    Changes the calculation for the crater profile, making the radius an absolute value rather than scaled relative to the image dimensions. This option is less commonly used for typical crater effects.

-smooth
    Applies a smoothing function to the crater's profile, resulting in a less abrupt and more gradual transition from the edge to the center of the depression.

-edge=percent
    Used in conjunction with -smooth. Specifies the percentage of the radius that forms the smoothed 'edge' region of the crater. For example, 10 means 10% of the radius is the smoothed transition area. This option is only effective when -smooth is also specified.

-depth=value
    Sets the maximum depth of the crater relative to the maxval. A value of 1 (the default) means the center will be 0 (black), creating the deepest crater. A value of 0 means no depth variation (a flat, uniform gray image). Values between 0 and 1 create various shades of gray for the center point, making the crater shallower.

DESCRIPTION

The pgmcrater command is a utility from the Netpbm package that creates a Portable Graymap (PGM) image representing a radially symmetric depression, often described as a 'crater'. The image pixels are brightest at the edges and progressively darker towards the center, mimicking a topographic depression or a grayscale radial gradient. This tool is valuable for generating various grayscale patterns, test images, or as a fundamental building block for more intricate image manipulations within the Netpbm suite. It outputs the generated PGM image to standard output, which can then be piped to other Netpbm utilities for further processing or redirected to a file for storage.

CAVEATS

pgmcrater generates its output directly to standard output (stdout). To save the resulting image, you must redirect stdout to a file (e.g., pgmcrater -width=200 -height=150 > crater.pgm) or pipe it to another command (e.g., pgmcrater | pgmtoppm > crater.ppm). It does not read any input from standard input.

USAGE EXAMPLES

To create a 200x150 PGM image with a default crater and save it to a file:
pgmcrater -width=200 -height=150 > my_crater.pgm

To create a smoothed crater with a lower maximum gray value (lighter appearance) and a specific edge:
pgmcrater -width=300 -height=300 -smooth -maxval=127 -edge=15 > smooth_crater.pgm

To pipe the output to another Netpbm utility (e.g., to convert PGM to PPM format for color):
pgmcrater -width=400 -height=400 | pgmtoppm > color_crater.ppm

HISTORY

pgmcrater is a component of the Netpbm project, a venerable and comprehensive toolkit for manipulating graphic images. Netpbm originated from the PBMplus package, which was developed by Jef Poskanzer in the late 1980s and early 1990s. The `pgmcrater` utility, like many Netpbm tools, adheres to the Unix philosophy of small, specialized programs that perform a single, efficient image transformation. Its development is focused on providing a fundamental building block for generating synthetic PGM images for a variety of purposes, from artistic effects to test patterns.

SEE ALSO

pgm(5), netpbm(1), pgmramp(1), pgmnoise(1), pgmtoppm(1), ppm(5), pbm(5)

Copied to clipboard