FBGAMMA(1)

πŸ“¦
version 7.44.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… fbgamma β€” the BRL-CAD glow-up page πŸ’…

okay so bestie, you found the fbgamma(1) page in the BRL-CAD manual, and honestly? it's lowkey iconic. it's all about loading a gamma-correcting colormap into a framebuffer so your screen stops lying to you. let's get into it ✨


✨ NAME ✨

fbgamma β€” load a gamma correcting colormap πŸŽ€


🌸 SYNOPSIS 🌸

fbgamma [-H] [-o] [-i] [-F framebuffer] val [gval bval]

that's the whole vibe. flags, then one value, or three. periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

so fbgamma loads a gamma correcting colormap into a framebuffer. that's the whole job and it eats every time πŸ’…

if you give it a single value, that number is used for all three color channels β€” one number, all the vibes. if you give it three values, they get applied to the red, green, and blue channels respectively. main character energy for each channel, we love to see it 🌈

now the actual science, because i'm not gonna gatekeep:

  • gamma values larger than one boost dim pixels with respect to bright ones. it's giving "hey little pixels, you matter too".
  • values less than one exaggerate the difference in brightness.

the former (bigger than one) has the effect of desaturating the displayed colors β€” literally washing them out 😭 β€” and the latter (less than one) will saturate the colors. and ngl, an uncorrected monitor is usually too saturated. always has been.

🚨 important detail bestie, do not skip this: since this program is intended for gamma correction, the exponent to which pixel values are raised is the inverse of the given value. so to linearize a display, 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), that can be done by giving a negative value β€” which means reciprocal in the usual mathematical sense. math girlies rise 🧚

πŸ’– OPTIONS πŸ’–

  • -F framebuffer β€” specify the framebuffer device to use. tell it where to live 🏠
  • -H β€” sets the default framebuffer size to 1024x1024 instead of 512x512. and this size distinction is genuinely important for devices like the Adage framebuffers, which have different operating modes based on the display size. no cap, it matters πŸ”₯
  • -i β€” display a standard gamma calibration image on the framebuffer. this image consists of intensity ramps with patches of solid color, and vertically adjacent patches containing alternating black and colored scanlines. then you adjust gamma values until vertically adjacent ramps of the same color appear equal in intensity for all patches. it's a whole vibe check for your monitor πŸ‘‘
  • -o β€” overlay mode. reads the current colormap from the framebuffer and applies the gamma correction to it, instead of starting from a linear ramp. useful for saturating or desaturating an arbitrary colormap. obsessed with the flexibility honestly 🫢
  • -h or -? β€” print usage information and exit. the polite escape hatch πŸ’€

⭐ THEORY ⭐

okay sit down, we're doing physics. the response of a typical monitor is non-linear with respect to input voltage. and to a fairly high degree of accuracy, that response can be expressed as:

display_intensity = input_voltage ^ gamma

where gamma will usually lie in the 2.0 to 3.0 range. and for the record: 2.2 is the NTSC standard gamma, and 2.5 is a commonly used "typical" value. iykyk πŸ“Ί

most of the time, pixel values of images have been computed assuming a linear mapping between pixel value and displayed intensity. and this linear mapping can be approximated by loading a colormap into the display which raises the pixel values to the inverse gamma power. that's the trick. that's the whole trick. slay ✨

ok but real talk: getting the gamma values "right" involves careful calibration and measurement of your display device. the values are likely to be different for each color channel, and will depend on the brightness setting, etc. so like... don't just guess and call it done πŸ™ˆ

and one more time for the people in the back πŸ’€:

  • a gamma value greater than unity will saturate colors by pushing them away from the white point and closer to the primaries.
  • a gamma less than unity will desaturate colors by moving them closer to the white point.

yes this sounds like the opposite of the description section. no i will not be explaining further, the manpage said both, i'm just the messenger πŸŽ€


πŸ”₯ EXAMPLES πŸ”₯

Example 1. Calibrate a framebuffer interactively

fbgamma -i 2.2

display the calibration image and load a gamma 2.2 correcting colormap. then adjust the value β€” re-running fbgamma with the image still on screen β€” until vertically adjacent ramps of the same color match in intensity across all patches. once matched, that value is the display gamma to use for the session. literally a glow-up ritual 🌸

Example 2. Display a pix image with proper gamma correction

fbgamma 2.2
pix-fb render.pix

load a gamma 2.2 correcting colormap into the default framebuffer, then send a pix(5) image to it with pix-fb(1). the image β€” which was computed assuming a linear intensity mapping β€” is now displayed correctly on a non-linear monitor without modifying the pixel data. no edits, all vibes πŸ¦‹

Example 3. Apply separate per-channel gamma to a named device

fbgamma -F /dev/X 2.3 2.1 2.4

load independent red, green, and blue gamma values into the X11 framebuffer, compensating for a display whose channels respond differently. three numbers, three moods, one icon πŸ’…


🌈 SEE ALSO 🌈

brlcad(1), fbcmap(1), fbcbars(1), pix-fb(1) β€” go read those too bestie, the lore is deep πŸ“š


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team 🫢


this software is Copyright (c) 1987-2026 by the United States Government as represented by U.S. Army Research Laboratory. iconic, protected, and legally slaying πŸ’œ


πŸ’€ BUG REPORTS πŸ’€

reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. found a bug? don't just suffer in silence, tell the group chat πŸ“§


and that's the page!! brought to you by BRL-CAD, manual section 1, honkin' FBGAMMA(1) β€” stay calibrated, stay saturated (or don't, that's literally the whole point of this tool) πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from