LinuxCommandLibrary

ppmrainbow

Create a rainbow-colored Portable Pixmap image

TLDR

Generate a rainbow consisting of the specified colors

$ ppmrainbow [color1 color2 ...] > [path/to/output_file.ppm]
copy

Specify the size of the output in pixels
$ ppmrainbow [[-w|-width]] [width] [[-h|-height]] [height] [color1 color2 ...] > [path/to/output_file.ppm]
copy

End the rainbow with the last color specified, do not repeat the first color
$ ppmrainbow [[-n|-norepeat]] [color1 color2 ...] > [path/to/output_file.ppm]
copy

SYNOPSIS

ppmrainbow [-width w] [-height h]

PARAMETERS

-width w
    Sets the width of the PPM image to w pixels. Defaults to 256 if not specified.

-height h
    Sets the height of the PPM image to h pixels. Defaults to 256 if not specified.

DESCRIPTION

The `ppmrainbow` command creates a Portable Pixmap (PPM) image consisting of a rainbow gradient. The output PPM image is written to standard output, allowing it to be redirected to a file or piped to other image processing utilities. The command's main purpose is to demonstrate PPM image format, testing image viewers or basic image manipulation pipelines. The appearance of the rainbow, including its width and height, can be adjusted using command line options. The colors used in the rainbow gradient span the visible spectrum, creating a visually appealing and useful tool for calibrating color displays or identifying color rendering issues.

EXAMPLES

1. Create a rainbow image with the default size:
`ppmrainbow > rainbow.ppm`

2. Create a larger rainbow image (512x512):
`ppmrainbow -width 512 -height 512 > larger_rainbow.ppm`

3. Convert the rainbow image to JPEG format:
`ppmrainbow | ppmtojpeg > rainbow.jpg`

SEE ALSO

ppm(5), pnmtoy4m(1), ppmtojpeg(1)

Copied to clipboard