Skip to content
Related Articles

Related Articles

Improve Article

PHP | Gmagick getimagegamma() Function

  • Last Updated : 21 Jan, 2020

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
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Get the gamma
$gamma = $gmagick->getimagegamma();
echo $gamma;
?>

Output:

0.45454999804497

Program 2 (For image with single color):




<?php
  
// Create a new Gmagick object
$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

My Personal Notes arrow_drop_up
Recommended Articles
Page :