Windows gamma adjustments
When porting Redshift to Windows I ran into trouble when setting a color temperature lower than about 4500K. The problem is that Windows sets limitations on what kinds of gamma adjustments can be made, probably as a means of protecting the user against evil programs that invert the colors, blank the display, or play some other annoying trick with the gamma ramps. This kind of limitation is perhaps understandable, but the problem is the complete lack of documentation of this feature (SetDeviceGammaRamp on MSDN). A program that tries to set a gamma ramp that is not allowed will simply fail with a generic error leaving the programmer wondering what went wrong.
There are workarounds, but you will not find them anywhere unless you have the patience to work your way through assembly listings of Windows DLLs. So here they are, for your convenience; these two tricks will work at least on a Windows 7 machine:
- Go to the registry database and create the key “GdiIcmGammaRange” (that’s a capital I in Icm as in Image Color Management) under “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM”. The type must be DWORD. The value determines the amount of adjustment that can be made, where 0 means no adjustments possible at all, and 256 means any adjustment is allowed. You’ll find a REG-file below that sets it to 256.
- Run your program from the Local System account.
So if you want to run the experimental build of Redshift on Windows, you need to use one of the above methods if you want to use the same color temperatures as are available on the linux version.
Update: Here’s a REG-file that will set the appropriate key in the registry:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM] "GdiIcmGammaRange"=dword:00000100
Save it with a “.reg” extension and double click to apply.
Binary Options Trading System
Originally published at jonls.dk.