Skip to documentation
DocumentationAll documentsEnglish

PIXBLEND(1)

NAME

pixblend - blend two pix(5) or bw(5) images

On this page

SYNOPSIS

pixblend [-r value | -i value] [-s seed] [-S] [-g gvalue] file1.pix file2.pix > out.pix

DESCRIPTION

pixblend reads two streams of data, typically pix(5) or bw(5) images, and writes a blended output stream of the same size. It operates pixel-by-pixel and is therefore independent of image resolution. Either input file may be given as - to read from standard input. With no -r or -i option, the default is linear interpolation with a value of 0.5 (an even mix of the two images).

OPTIONS

-r value

Random blending. For each pixel a number is drawn uniformly from [0, 1]; if it exceeds value the pixel from file1 is output, otherwise the pixel from file2. A value of 0 yields file1 and 1 yields file2. Mutually exclusive with -i.

-i value

Linear interpolation. Each output pixel is (1.0 - value) * pixel1 + value * pixel2. A value of 0 yields file1 and 1 yields file2. Mutually exclusive with -r.

-s seed

Set the random number seed to seed (default 0). Affects -r.

-S

Seed the random number generator from the system clock instead of a fixed value.

-g gvalue

Glitterize. When the random draw for a pixel falls below gvalue the output pixel is set to white; otherwise the pixel is chosen as for -r. Cannot be combined with -i.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Cross-fade two images
pixblend -i 0.25 a.pix b.pix > out.pix

Produces an image that is 75% a.pix and 25% b.pix, useful for generating intermediate frames of a dissolve between two renderings.

Example 2. Animated dissolve sequence
for f in $(seq 0 9); do
    pixblend -i 0.$f a.pix b.pix > frame$f.pix
done

Generates ten frames stepping the interpolation value from 0.0 to 0.9, the basis of a smooth cross-dissolve animation that can be fed to pix-fb(1) or assembled into a movie.

Example 3. Reproducible random speckle blend
pixblend -r 0.5 -s 23 a.pix b.pix > out.pix

Randomly selects each pixel from one of the two images with an even probability, using a fixed seed of 23 so the result is repeatable.

SEE ALSO

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

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1995-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