Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My work PC (Windows 7 Pro x64) has dual monitors and a very washed-out looking default color profile. I get around this by running the NVIDIA Control Panel and setting the gamma slider to about 0.50 and applying the changes. Works great.

The problem is that I work remotely roughly half the time, and when I am at home I use Remote Desktop to connect to the work PC. When I come back to the office, the gamma settings reset to their default, washed-out levels, even though the control panel gamma slider is still at 0.5.

My "fix" is to open the control panel and move the slider for each monitor ever-so-slightly to apply new gamma settings. It works but it's very annoying to have to do every day.

I see people with similar issues:

nVidia Control Panel resets Gamma setting after restart

my gamma automatically changes coming out of standby

Though we have the same problem, I'm interested in scripting a solution to this. Ideally, I'd like a script to run on login that will force my gamma settings to where I want them.

Is there a standard command line way to apply gamma settings in Windows 7?

share|improve this question
up vote 1 down vote accepted

It is possible to do something like this using scripting utilities like AutoIT, C# and other programming languages. Any language that can interface with gdi32.dll, for example, should be able to accomplish this task.

Here's an example found for AutoIt:

Func _SetGamma ( $vRed=128, $vGreen=128, $vBlue=128 )
    Local $n_ramp, $rVar, $gVar, $bVar, $Ret, $i, $dc
    If $vRed < 0 Or $vRed > 386 Then Return -1
    If $vGreen < 0 Or $vGreen > 386 Then Return -1
    If $vBlue < 0 Or $vBlue > 386 Then Return -1
    $dc = DLLCall ( "user32.dll", "int", "GetDC","hwnd", 0 )
    $n_ramp = DllStructCreate ( "short[" & ( 256*3 ) & "]" )
    For $i = 0 to 256
    $rVar = $i * ( $vRed + 128 )
    If $rVar > 65535 Then $rVar = 65535
    $gVar = $i * ( $vGreen + 128 )
    If $gVar > 65535 Then $gVar = 65535
    $bVar = $i * ( $vBlue + 128 )
    If $bVar > 65535 Then $bVar = 65535
    DllStructSetData ( $n_ramp, 1, Int ( $rVar ), $i  ) ; red
    DllStructSetData ( $n_ramp, 1, Int ( $gVar ), $i+256 ) ; green
    DllStructSetData ( $n_ramp, 1, Int ( $bVar ), $i+512 ) ; blue
    $ret = DLLCall ( "gdi32.dll", "int", "SetDeviceGammaRamp", "int", $dc[0], "ptr", DllStructGetPtr ( $n_Ramp ) )
    $dc = 0
    $n_Ramp = 0
EndFunc ;==> _SetGamma ( )

The source for this can be found here: TinyBrightnessControler v

it would be very little work to compile that into an executable file that can run in a start-up script.

share|improve this answer
AutoIt is unassuming enough that I have no issue just clicking the tray icon to change my settings - TinyBrightnessController is perfect right out of the box! Thank you! – Stefan Mohr Feb 2 '12 at 16:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.