Name

pixborder — add a 1-pixel-wide border to regions of a specified color

DESCRIPTION

Pixborder reads an input stream of pix data, looking for maximal contiguous regions of a specified interior color, and writes out the pix data with all pixels on the boundaries of these regions changed to a specified border color.

The way pixborder decides if a given pixel is on the boundary depends on how the user specified the interior and exterior. The -i option causes pixborder to replace the default interior color of 255 255 255 by R G B, while the -I replaces it by H S V, which are reals, with H in [0, 360) and S, V in [0, 1]. Similarly, the -e and -E options replace the default exterior color of 1 1 1. If the user specified colors for both or neither of the interior and exterior, then a pixel is on the boundary provided that it has the interior color and at least one of its four neighbors (left, right, above, and below) has the exterior color. If, on the other hand, the user specified only the interior (exterior) color, then a pixel is on the boundary provided that it has the interior color (does not have the exterior color) and at least one of its neighbors does not have the interior color (has the exterior color).

Variability in the interior and exterior colors may be accommodated by the -t and -T options, with which one specifies a symmetric tolerance for each of the red, green, and blue channels or hue, saturation, and value. Any color within the specified tolerance of the nominal interior (exterior) color is treated as though it were the nominal color.

Changes are restricted to a specified rectangular portion of the image, which defaults to the entire image. The -x option sets the left edge of that rectangle: no pixels to the left of this edge are changed. The -X, y, and Y options respectively set the right, bottom, and top edges in the same manner.