LinuxCommandLibrary

ppmmake

Create a portable pixmap image

TLDR

Create a PPM image of the specified color and dimensions

$ ppmmake [color] [width] [height] > [path/to/output_file.ppm]
copy

SYNOPSIS

ppmmake [options] [width height]
ppmmake [options] command_file

PARAMETERS

-background color
    Sets the background color of the image.

-line color
    Sets the color for lines drawn.

-box color
    Sets the fill color for boxes drawn.

-fill
    Draws filled boxes instead of outlines.

-r value, -g value, -b value
    Specify individual red, green, and blue components (0-255) for the most recently set color (background, line, or box).

-rgb r,g,b
    Specify a color using comma-separated red, green, and blue components (0-255).

-color name
    Specify a color using a standard X11 color name (e.g., 'red', 'lightgray').

-size width height
    Sets the width and height of the output image in pixels.

-nomap
    Outputs a truecolor image without a colormap (i.e., not indexed color).

-novertical
    Prevents drawing vertical grid lines.

-nohorizontal
    Prevents drawing horizontal grid lines.

-transparent
    Makes the background transparent. This is only effective if the output image format supports transparency (e.g., when piped to a tool like pnmtopng(1)).

DESCRIPTION

The ppmmake command is a versatile utility within the Netpbm image manipulation toolkit. It is designed to create basic Portable Pixmap (PPM) images from scratch by programmatically drawing filled rectangles and lines. This tool is particularly useful for generating a variety of visual elements such as test patterns, color swatches, or simple graphical components, bypassing the need for a complex image editor. Users have precise control over the output, being able to specify the image dimensions, background color, and distinct colors for both the lines and the filled boxes. Furthermore, ppmmake offers the flexibility to read drawing commands from a specified file, which significantly enhances its utility for creating more intricate or repeatable image designs efficiently through scripting.

CAVEATS

ppmmake primarily outputs PPM format, which does not natively support transparency. For transparent output, the generated PPM must be piped to a tool like pnmtopng(1). The drawing capabilities are limited to simple lines and filled rectangles; complex shapes or text are not supported directly.

INPUT FROM FILE

Instead of specifying width and height directly, ppmmake can read drawing commands from a specified file. Each line in the file represents a command (e.g., 'background red', 'line 10 10 50 50'), allowing for more structured and complex image generation. This is useful for creating repeatable patterns or larger sets of drawing instructions.

COLOR SPECIFICATION

Colors can be specified using various methods: by name (e.g., 'red'), by RGB components (e.g., '255,0,0'), or individually using -r, -g, -b options. The order of color options matters; subsequent -r, -g, -b, or -rgb options modify the color set by the preceding -background, -line, or -box option.

HISTORY

ppmmake is a long-standing utility within the Netpbm project, which originated from Jef Poskanzer's PBMPlus toolkit in the late 1980s. Its core purpose has remained consistent: to provide a simple, scriptable way to generate basic graphical patterns. It embodies the Netpbm philosophy of small, focused tools that can be chained together in pipelines.

SEE ALSO

ppm(5), pnm(5), netpbm(1), pnmdraw(1), ppmdraw(1), pnmtopng(1)

Copied to clipboard