pixmerge — merge two pix(5) or bw(5) images by a formula
pixmerge, given two streams of data, typically pix(5) or bw(5) images, generates an output stream of the same size, where the value of the output is determined by a formula involving the first (foreground) stream and the second (background) stream, with the option of using a constant in place of the background stream. This routine operates on a pixel-by-pixel basis, and thus is independent of the resolution of the image. More sophisticated processing can be performed by pixmatte .
If a constant is to be used in place of the background stream, it is supplied via the
option, with the constant color specified by r/g/b .
(Exception: see below for default zeroes
being used with default
It is expected that there will be up to
slash-separated constants given as a single parameter here.
-C is used, the
background.pix argument is omitted.
The formula can be any combination of
(fg greater than bg),
(fg less than bg),
(fg equal to bg),
(fg not equal to bg).
selects the foreground pixel when it
is lexically less than or equal to the background pixel,
that is, when each byte of the foreground pixel is less than
or equal to the corresponding byte of the background pixel; if said
relationship is found to be false, the background pixel is selected.
flag specifies the width (in bytes) of each "pixel"; the default is
file format. A width of 1 is used for processing
files. It is unclear if other widths are useful.
If no formula is specified, the default is to use
-g, taking all foreground
pixels greater than a constant (
-C parameter if that option is used, otherwise
defaulting to black, which is specified with all bytes zero). If the default formula and constant
are used (and
-a was NOT used), this is the same as:
pixmerge -g -C 0/0/0 fg.pix
gencolor 200 0 200 | pixmerge -g fg.pix - > out.pix
pixbackgnd -t0 160 200 | pixmerge -n fg.pix - | pix-fb
The second example is used to composite an rt(1) generated image on top of a shaded background.
This software is Copyright (c) 1989-2016 by the United States Government as represented by U.S. Army Research Laboratory.