Here is a small piece of code that may prove useful to someone. This program allows you to set the brightness (black level), contrast, and gamma of the screen, independently for each colour channel on the X server side. Thus, this program should work for all graphics cards supporting the required X vidmode extensions (works for my Radeon 8500 perfectly).
NOTE. This program is still more or less in beta stage. If you experience problems, or wish to have more information about this program, drop me a line at jisohata at student dot oulu dot fi. Use this program at your own risk! There's no warranty of any kind, and the program can mess up your screen completely.
See the copyright notices / license in the source code for copying and modifying this software. (GPLv2 and XFree86 license notes)
Version 0.12 xbcg v. 0.12
xbcg [-display display] [-screen screen] [-quiet] [-force] [-gamma f.f | -gamma r.r g.g b.b] [-brightness f.f | -brightness r.r g.g b.b] [-contrast f.f | -contrast r.r g.g b.b]
On output, the program prints the chosen values, and warns about colour clipping or crushing.
The program loads a custom colour curve into X. The curve maps input pixel value xin, 0 ≤ x ≤ 1 , into output value xout via the formula
where b, c, and g are the given brightness, contrast, and gamma, respectively. I don't know if this is the standard formula, but at least I find it intuitive.
For long I wasn't able to use Linux and X because of my poor monitor. Everything below graylevel of about 25% were crushed to black, making X completely useless when I wanted to edit photos, for example. Of course, I could have used xgamma to set gamma correction, but to get the darkest pixels visible, I'd have to use gamma of about 3, which meant that the brighter parts of the screen were completely washed out. The controls on the monitor itself, well, they are a real joke. If you have a monitor like mine, you know what I'm talking about.
I decided to remedy the situation. With some research into X vidmode extensions, I was able to find an easy way of loading a custom gamma ramp. This program only provides a simple user interface to those functions.
I hope this program helps someone!
Back to my personal pages