PHP | imagegammacorrect() function
Last Updated :
30 Jan, 2020
The imagegammacorrect() function is an inbuilt function in PHP which is used to apply gamma correction to the given image given an input and an output gamma.
Syntax:
bool imagegammacorrect( resource $image, float $inputgamma, float $outputgamma )
Parameters:This function accepts three parameters as mentioned above and described below:
- $image: It specifies the image to be worked upon.
- $inputgamma: It specifies the input gamma.
- $outputgamma: It specifies the output gamma.
Return Value: This function returns TRUE on success or FALSE on failure.
Exceptions: This function throws Exception on error.
Below given programs illustrate the imagegammacorrect() function in PHP:
Program 1:
<?php
imagegammacorrect( $im , 3, 1.3);
header( 'Content-Type: image/png' );
imagepng( $im );
imagedestroy( $im );
?>
|
Output:
Program 2:
<?php
$im = imagecreatetruecolor(800, 250);
imagefilledrectangle( $im , 0, 0, 800, 250, imagecolorallocate( $im , 0, 0, 180));
imagefttext( $im , 80, 0, 50, 130, imagecolorallocate( $im , 0, 150, 0), './Pacifico.ttf' , 'GeeksforGeeks' );
imagegammacorrect( $im , 3, 1.3);
header( 'Content-Type: image/png' );
imagepng( $im );
imagedestroy( $im );
?>
|
Output:
Reference: https://www.php.net/manual/en/function.imagegammacorrect.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...