The graphics functions let you adjust the gamma of images as well, which effectively adjusts their brightness, with imagegammacorrect: imagegammacorrect(resource image, float inputgamma, float outputgamma) This function applies gamma correction to an image given an input gamma, the parameter inputgamma, and an output gamma, the parameter outputgamma. You can see an example that will lighten our image, image.jpg, and display the result in phpgamma.php, Example 15. Example 15. Adjust image gamma, phpgamma.php<?php $image_height = 100; $image_width = 300; $image = imagecreatefromjpeg ("image.jpg"); imagegammacorrect($image, .5, 2.5); header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); ?> We'll embed the result in phpgamma.html, and you can see it in Figure 16. Figure 16. Adjusting image gamma. |