pgmmake
Create a portable graymap image
TLDR
Create PGM image with a uniform gray level (specified as a number between 0 and 1) and the specified dimensions
SYNOPSIS
pgmmake [-maxval=N] [-plain] width height [pattern_name]
PARAMETERS
width
The width of the generated PGM image in pixels.
height
The height of the generated PGM image in pixels.
-maxval=N
Sets the maximum gray value for the image. Defaults to 255. A lower value creates a darker image; a higher value allows for more intensity levels.
-plain
Outputs the PGM image in plain (ASCII) format instead of the default raw (binary) format. Plain format is human-readable but larger.
pattern_name
Specifies the pattern to be used for generating the image. Common patterns include 'fill' (default, solid gray), 'checkerboard', 'gradient', 'hlines', 'vlines', 'diagdown', 'diagup', 'circle', and 'random'.
DESCRIPTION
pgmmake is a utility from the Netpbm suite designed to create Portable Graymap (PGM) images based on user-defined dimensions and a specified pattern. It's particularly useful for generating test patterns, simple backgrounds, or placeholder images for development and testing purposes. Unlike image manipulation tools, pgmmake generates images from scratch, applying various built-in algorithms to produce visual effects such as gradients, checkerboards, or random noise. Users can control the image's width, height, and the maximum gray value, which determines the intensity range of the pixels. The generated image is output to standard output, making it easy to pipe to other Netpbm tools or save to a file. Its simplicity and focused functionality make it a valuable tool for quick image generation without needing complex graphical editors.
CAVEATS
pgmmake generates images from predefined patterns and does not support reading or modifying existing image files. Its output is limited to the PGM (graymap) format; for color images, other Netpbm tools like ppm(5) or pam(5) would be required. The available patterns are fixed and cannot be customized beyond their inherent parameters (e.g., gradient direction, checkerboard size are fixed within the pattern type).
OUTPUT FORMAT
By default, pgmmake outputs a raw PGM image, which is efficient for computer processing. The -plain option can be used to generate an ASCII representation, which is larger in file size but can be inspected or edited with a text editor.
PATTERN TYPES
Beyond the default 'fill' pattern, pgmmake offers a variety of patterns: checkerboard for alternating squares, gradient for smooth transitions, hlines and vlines for horizontal/vertical stripes, diagdown and diagup for diagonal lines, circle for a circular pattern, and random for noise. Each pattern serves distinct purposes for testing or visual effects.
HISTORY
pgmmake is an integral part of the Netpbm project, a well-established toolkit for graphics file format conversion and manipulation. The Netpbm suite originated from Pbmplus in the late 1980s, developed by Jef Poskanzer. Over the decades, it has evolved into a robust collection of hundreds of small, focused command-line utilities. pgmmake specifically provides a basic image generation capability within this ecosystem, reflecting the Netpbm philosophy of simple tools performing specific tasks that can be chained together via pipes. Its development has been incremental, ensuring compatibility and stability across various Unix-like systems.