FBGAMMA 1 BRL-CAD BRL-CAD
fbgamma load a gamma correcting colormap
`fbgamma` -H -o -i -F framebuffer val gval bval

## DESCRIPTION

`fbgamma` loads a gamma correcting colormap into a framebuffer. If a single value is given, that number is used for all three color channels. If three values are specified, they will be applied to the red, green, and blue channels respectively.

Gamma values larger than one will boost dim pixels with respect to bright ones. Values less than one will exaggerate the difference in brightness. The former has the effect of desaturating the displayed colors ("washing them out"), the latter will saturate the colors. An uncorrected monitor is usually too saturated.

Note that since this program is intended for gamma correction, the exponent to which pixel values are raised is the inverse of the given value. To linearize a display then, the given value will be equal to the gamma of the display (typically 2.0-3.0, see below). If you wish to directly apply an exponent to a picture (rather than its inverse), this can be done by giving a negative value (which means reciprocal in the usual mathematical sense).

By default, this program will "correct to linear", that is to say, it will apply correction to a standard linear ramp. If you wish to "correct" some other colormap, e.g. an inverse video map, the `-o` overlay option can be used. This will read whatever colormap is currently in the framebuffer and operate on it. One useful result of this is the ability saturate or desaturate an arbitrary colormap.

By default, the display is assumed to be 512x512 pixels; if the `-H` flag is specified, the size is changed to 1024x1024. This size distinction is important for devices like the Adage framebuffers which have different operating modes based on the display size. In general, `fbgamma` manipulates the RGB color maps in the graphics hardware, and has an effect on the entire screen, not just the portion containing the current framebuffer display. As such, there is no need to match the display size on the command line.

A framebuffer may be explicitly selected with the `-F` option, followed by the name of the desired framebuffer.

The `-i` option requests that a standard gamma calibration image be displayed on the framebuffer. This image consists of intensity ramps with patches of solid color, and vertically adjacent patches containing alternating black and colored scanlines. When using gamma to compensate for non-linearity of a display, the gamma values should be adjusted until vertically adjacent ramps of the same color appear equal in intensity for all patches.

## THEORY

The response of a typical monitor is non-linear with respect to input voltage. To a fairly high degree of accuracy, the response can be expressed as:

display_intensity = input_voltage ^ gamma,

where gamma will usually lie in the 2.0 to 3.0 range (2.2 is the NTSC standard gamma, 2.5 is a commonly used "typical" value). Most of the time, pixel values of images have been computed assuming a linear mapping between pixel value and displayed intensity. This linear mapping can be approximated by loading a colormap into the display which raises the pixel values to the inverse gamma power.

It should be noted that getting the gamma values "right" involves careful calibration and measurement or your display device. The values are likely to be different for each color channel, and will depend on the brightness setting, etc. (increasing the monitor brightness often lowers the gammas, due to overdriving the high end of the display). Also note that getting the correct colors from a display requires knowledge of the phosphor chromaticities.

If possible one should gamma correct a picture before loading it into a display or saving it as eight bit linear data. This is because the response of the human visual system to brightness is also exponential in nature, and thus having "smaller steps" at the dark end of the display, and larger ones near full bright (as an uncorrected display will have), fits this response well. Gamma correction via the colormap cannot exploit this.

A gamma value greater than unity will saturate colors by pushing them away from the white point and closer to the primaries (as viewed on a chromaticity diagram). A gamma less than unity will desaturate colors by moving them closer to the white point.

## SEE ALSO

brlcad 1, fbcmap 1, cmap-fb 1, fb-cmap 1

## AUTHOR

BRL-CAD Team

## COPYRIGHT

This software is Copyright (c) 1987-2024 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 w