Name

pixmatte — matte (merge) two pix(5) or bw(5) images by a formula

DESCRIPTION

Given four streams of data elements, where element is of arbitrary width, typically pix(5) or bw(5) images, pixmatte outputs a stream of the same number of data elements. The value of the output stream is determined element-by-element, by comparing the first (foreground) input stream with the the second (background, or matte) input stream. If the formula holds true, the element from the true-output stream is written, otherwise, the element from the false-output stream is written. Each of these streams comes from a file, or is given as a constant. A particular file may be used to feed more than one stream, and the name '-' specifies stdin. For example, the foreground file may also be the true-output file. This routine operates on an element-by-element basis, and thus is independent of the resolution of the image.

The formula can be any combination of -g (in1 greater than in2), -l (in1 less than in2), -e (in1 equal to in2), -n (in1 not equal to in2). For example, -ge specifies in1 greater than or equal to in2.

The -a flag can be used with -n or -e to specify approximately equal or approximately not equal to match dithered backgrounds. Approximate equality exists when all bytes in the elements match to within plus or minus one.

For example, -le is true when in1 is lexically less than or equal to in2, that is, when all bytes of the in1 element are less than or equal to the bytes of the in2 element. The -w# flag specifies the width (in bytes) of each element; the default is 3, i.e. pix(5) file format. A width of 1 is used for processing bw(5) files. It is unclear if other widths are useful.

A constant value is specified instead of a filename if the first character of the file name is a equal sign '='. The value is specified as a slash separated string of width decimal numbers, with no separating white space.