Open In App

PHP | Gmagick getimagegamma() Function

Last Updated : 21 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
The Gmagick::getimagegamma() function is an inbuilt function in PHP which is used to get the image gamma. The Gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in images. Syntax:
float Gmagick::getimagegamma( void )
Parameters: This function doesn’t accept any parameter. Return Value: This function returns an float value containing the gamma. Exceptions: This function throws GmagickException on error. Below given programs illustrate the Gmagick::getimagegamma() function in PHP: Program 1 (For image with multiple colors): php
<?php

// Create a new Gmagick object
// https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png
$gmagick = new Gmagick('geeksforgeeks.png');

// Get the gamma
$gamma = $gmagick->getimagegamma();
echo $gamma;
?>
Output:
0.45454999804497
Program 2 (For image with single color): php
<?php

// Create a new Gmagick object
// https://media.geeksforgeeks.org/wp-content/uploads/20200106200505/singlecolor.png
$gmagick = new Gmagick('singlecolor.png');

// Get the gamma
$gamma = $gmagick->getimagegamma();
echo $gamma;
?>
Output:
0
Reference: https://www.php.net/manual/en/gmagick.getimagegamma.php

Next Article

Similar Reads