Hi,
Thursday, March 13, 2003, 8:09:45 AM, you wrote:
DH> Hi,
DH> I hope this is the right newsgroup for this so if it is not, please,
DH> excuse me.
DH> I would like to be able to change the brightness of an image using PHP.
DH> Here are some more detiails: I would like to load a jpeg file from a
DH> webpage, change the brightness of the image, and save it back to a file.
DH> I am pretty sure how to load and save the file but I can not figure out
DH> how to change the brightness.
DH> I am using PHP 4.1.2.
DH> Thanx
DH> -- Mitko
DH> --
DH> ---------------------------------------------------
DH> To reply remove all CAPS letters from email address
DH> ---------------------------------------------------
DH> The little town that time forgot,
DH> Where all the women are strong,
DH> The men are good-looking,
DH> And the children above-average.
DH> -- Prairie Home Companion
You need to get the rgb values for each pixel and add a fixed number
to them and finaly make sure the value peaks at 255 then put them back.
You will probably get a more pleasing effect if you scale the brightness
by adding more and the black end and tailing off towards white (gamma).
You can do this by creating a lookup table for the value to add and converting
the rgb values to monochrome to get the lookup key.
Or play with this gd function :)
$im =imagecreatefromjpeg($filename);
imagegammacorrect($im,1,2.2);
Header("Content-type: image/jpeg");
ImageJpeg($im,'',50);
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php