# xpand(9) [plan9 man page]

XPAND(9.1)XPAND(9.1)NAME

xpand, picnegate - adjust dynamic rangeSYNOPSIS

fb/xpand [] [ input ] [ lo hi [ inlo inhi ] ] fb/picnegate [ input ]-sDESCRIPTION

Xpand linearly adjusts the dynamic range of the input picture (default standard input) mapping value inlo to lo, and inhi to hi. Lo and hi default to 0 and 255. If inlo and inhi are not specified, the lowest and highest pixel values in the input image are used. By default, then, xpand expands the image's dynamic range by mapping its smallest pixel value to zero and its largest value to 255. Optioncauses all channels of the input image to be considered together when computing default values for inlo and inhi, thus preserving the hue of rgb pictures. Otherwise, each channel is treated separately. Option-shas no effect if inlo and inhi are specified on the command line. There is no requirement that lo be smaller than hi, or that inlo be smaller than inhi, nor that any of those values be in the range 0 to 255. Output values not in the range 0 to 255 are clamped. For example, xpand 0 255 255 0 inverts the pixel values of its input. For convenience, picnegate is a script that executes this command.-sSOURCE

/sys/src/fb/xpand.cSEE ALSO

picfile(9.6) XPAND(9.1)

## Check Out this Related Man Page

FILTERS(9.1)FILTERS(9.1)NAME

adapt, ahe, crispen, laplace, edge, edge2, edge3, extremum, median, nonoise, smooth, shadepic - image neighborhood operatorsSYNOPSIS

fb/adapt [ input ] fb/ahe [ input ] fb/crispen [ input ] fb/laplace [ input ] fb/edge [ input ] fb/edge2 [ input ] fb/edge3 [ input ] fb/extremum [ input ] fb/median [ input ] fb/nonoise [ input ] fb/smooth [ input ] fb/shadepic [y z ] [ input ]-lxDESCRIPTION

Gathered here are descriptions of programs that compute the pixels of an output image by performing some operation on a neighborhood of each pixel of their input image (default standard input). Each program writes the output image on standard output. The programs process multi-channel inputs by treating each channel independently. Adapt performs adaptive contrast enhancement by examining the 7x7 region centered on each input pixel, remapping the center pixel linearly in a way that would send the neighborhood's maximum value to 255 and its minimum to 0. To avoid divide checks, no mapping is done if all pixels in the region have the same value. Ahe performs adaptive histogram equalization by examining the 17x17 region centered on each input pixel, counting the number of pixels whose value is less than the center pixel. (It counts 1/2 for each pixel equal to the center value.) Output pixel values are 255 times the count divided by the window size. Crispen examines the 3x3 region surrounding each input pixel, computing 9 times the center pixel minus the sum of its eight neighbors. This is a fairly extreme high-pass filter and sharpens edges substantially. Laplace computes 5 times the center pixel minus the sum of its four vertical and horizontal neighbors. This adds a 3x3 discrete Laplacian to the original image, and is a less extreme high-pass filter than crispen. Edge, edge2, and edge3 detect edges in various ways. Edge examines the 3x3 region surrounding each input pixel, outputting 8 times the center value minus the sum of its eight neighbors. Edge2 applies a Sobel operator to the input image. It approximates the image's gradient by finite differences on a 3x3 neighborhood, out- putting the vector length of the gradient approximation. Edge3 likewise approximates the gradient of the input image. The output is roughly the phase angle of the gradient approximation, scaled between 0 and 255. Extremum examines the 3x3 region surrounding each input pixel, outputting the value that differs most from the center value. In case of a tie, the larger candidate is chosen. Median does noise reduction by replacing each pixel of the input image by the median of the 3x3 region surrounding it. Nonoise implements the Bayer-Powell noise reduction filter. It computes the average value of the eight neighbors of each pixel of the input image, and substitutes it for the pixel value if the two differ by more than 64. Smooth low-pass filters its input image by convolution with a Bartlett window. Shadepic treats its input image as an array of elevations. At each pixel it approximates the normal vector to the height-field by finite differences on a 3x3 neighborhood and outputs 255 times its dot product with the unit vector in the light-source direction specified by option(default 1,-l,1). If the dot product is negative, it is clamped at zero. (This computation is just Lambertian diffuse reflec- tion.)-1SOURCE

/sys/src/fbSEE ALSO

picfile(9.6)BUGS

There are too many weird wired-in sizes. FILTERS(9.1)