Resizing images with correct gamma using PHP and GD
http://www.jejik.com/articles/2010/07/resizing_images_with_correct_gamma_using_php_and_gd/