Skip to documentation
DocumentationAll documentsEnglish

GENCOLOR(1)

NAME

gencolor - output a repeated pattern of byte values

On this page

SYNOPSIS

gencolor [-p | -b] [-r _count_] [-s _squaresize_ | -S _squaresize_] [-w _width_ | -W _width_] [-n _height_ | -N _height_] [_val1_ ... _valN_] > _output_file_

DESCRIPTION

gencolor writes a repeated pattern of 8-bit byte values to standard output. The pattern values (each ranging from 0 to 255) are taken from the command-line arguments, or, if none are given, are read in binary form from standard input. With no arguments and no piped input, a single default value of 0 (black) is used. The assembled pattern may be up to 131072 bytes long.

By default the pattern repeats forever. The -r option limits the output to a fixed number of pattern repetitions. Alternatively, specifying an image geometry (-s/-S, -w/-W, -n/-N) or an output format (-p, -b) causes gencolor to emit exactly enough bytes to fill one image of the given dimensions, making it convenient for generating solid-color pix(5) or bw(5) backgrounds.

gencolor refuses to write to a terminal; redirect its output to a file or pipe it to another command.

OPTIONS

-p

Assume pix(5) output (3 bytes per pixel). This is the default and affects only the byte count computed when an image geometry is requested without -r.

-b

Assume bw(5) output (1 byte per pixel).

-r count

Repeat the pattern count times. The default is to repeat forever (unless an image geometry option supplies a count instead).

-w width
-W width

Set the image width in pixels. The default is 512.

-n height
-N height

Set the image height in pixels. The default is 512.

-s squaresize
-S squaresize

Set both the image width and height to squaresize pixels.

-h
-?

Print the usage message and exit.

EXAMPLES

Example 1. Generate a solid green 512x512 pix image
gencolor -p -s 512 0 255 0 > green.pix

The three-byte RGB pattern (0 255 0) is repeated to fill a 512x512 pix(5) image, yielding 512 * 512 * 3 bytes. The resulting file can be viewed with pix-fb(1) or pixmatte(1).

Example 2. Tile a gradient background under a rendering
gencolor -b -w 1024 -n 768 128 > gray.bw
pix-fb scene.pix

The first command produces a 1024x768 single-channel bw(5) image filled with mid-gray (value 128), suitable as a neutral backdrop or matte before compositing a rendered pix(5) image onto the framebuffer.

SEE ALSO

brlcad(1), pix(5), bw(5), pix-fb(1), pixmatte(1)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org