This PHP script will choose from two different gamma-corrected images based on whether the page is being viewed from a Windows/*nix machine or a Mac. Macs generally have a target gamma of 1.8 while Windows and non-Apple *nix has a target of 2.2 or 2.4 (which usually nets out to about 2.2 in average lighting). The result is that images made on Macs look too dark on everything else and images made on everything else look too light on Macs. This script solves the problem by detecting which platform the browser is running on and automatically redirects the request to an appropriate gamma-corrected copy that you've prepared ahead of time.
Yes, you do have to manually prepare two versions of each image, but if you're a visual artist of some sort and have an online gallery of your work, it may be worth the extra effort to allow people to see it [relatively] accurately.
-2.2immediately before the file extension. Example: if your file name would normally be
<img>tag with a parameter named
img. Set it to what you would have ordinarily named the file, as above:
<img src="gamma.php?img=MyPhoto.jpg" width="x" height="x" alt="x" />
-2.2before the extension.
imgparameter, as in
<img src="gamma.php?img=/gallery/2/MyPhoto.jpg" width="x" height="x" alt="x" />
Copyright © 2006 Nicolai Grossman
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Current version: gamma-v1.0.zip