LinuxCommandLibrary

ppmpat

Apply patterns to PPM image files

TLDR

Produce a PPM file of the specified pattern with the specified dimensions

$ ppmpat -[gingham2|gingham3|madras|tartan|poles|...] [width] [height] > [path/to/file.ppm]
copy

Produce a PPM file of a camo pattern using the specified colors
$ ppmpat [[-ca|-camo]] [[-co|-color]] [color1,color2,...] [width] [height] > [path/to/file.ppm]
copy

SYNOPSIS

ppmpat width height [pattern [pattern_options]]

PARAMETERS

width
    The desired width of the output image in pixels.

height
    The desired height of the output image in pixels.

pattern
    The type of pattern to generate. Common patterns include:
solid: A solid color.
hgradient, vgradient: Horizontal/vertical gradients.
hbars, vbars: Horizontal/vertical bars.
checkerboard: A square checkerboard pattern.
hcheckerboard, vcheckerboard: Half-checkerboard (diagonal).
circles: Concentric circles.
sines, hsines, vsines: Sine wave patterns.
colorbars: Standard television color bars.

pattern_options
    Options specific to the chosen pattern type. These vary greatly depending on the selected pattern.
-color : Sets the primary color (e.g., 'red', '#FF0000').
-color2 : Sets a secondary color for multi-color patterns.
-fade : For gradients, specifies color fade amount (0.0 to 1.0).
-barwidth : For bar patterns, sets the width of each bar.
-rows , -cols : For checkerboards, number of rows/columns.
-amplitude , -frequency , -wavelength , -offset : For sine wave patterns.

DESCRIPTION

ppmpat is a utility from the Netpbm suite that creates various types of test patterns as a Portable Pixmap (PPM) image. It's often used for display testing, calibration, or debugging graphics pipelines. Users can specify the image's dimensions (width and height) and choose from several predefined pattern types, such as solid colors, linear gradients, horizontal or vertical bars, checkerboards, concentric circles, and sine wave patterns. The output is written to standard output, making it easy to pipe to other Netpbm tools or redirect to a file. It's a foundational tool for image generation within the Netpbm ecosystem, providing simple yet powerful pattern generation capabilities.

CAVEATS

ppmpat always outputs to standard output; it must be redirected to a file or piped to another Netpbm tool.
Pattern-specific options are only valid when their respective pattern is chosen; using an invalid option will result in an error.
Color names (e.g., 'red') are system-dependent and may not be universally available; hexadecimal RGB values are more portable.

OUTPUT FORMAT

ppmpat exclusively generates images in the Portable Pixmap (PPM) format. The output is written to standard output (stdout), which necessitates redirection to a file (e.g., `ppmpat 100 100 solid > image.ppm`) or piping to another program for further processing or display (e.g., `ppmpat 100 100 checkerboard | pnmtopng > image.png`).

COLOR SPECIFICATION

Colors can be specified either by a common English name (e.g., 'red', 'green', 'blue') or by a hexadecimal RGB value (e.g., '#FF0000' for red, '#00FF00' for green). The availability of color names depends on the system's color database (often `/etc/X11/rgb.txt`). Hexadecimal values offer more precise and portable color control.

HISTORY

ppmpat is an integral part of the Netpbm package, a comprehensive suite of graphics manipulation programs for Unix-like systems. Netpbm originated from the earlier PBMplus package and has been under continuous development for decades. It adheres to the Unix philosophy of small, specialized tools that can be combined, making ppmpat a classic example of a single-purpose utility designed for generating basic image patterns efficiently.

SEE ALSO

ppm(5), pnm(5), netpbm(1), pnmtopng(1), ppmtogif(1)

Copied to clipboard