PHP | Gmagick getimagehistogram() Function Last Updated : 21 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The Gmagick::getimagehistogram() function is an inbuilt function in PHP which is used to get the image histogram. This function returns all the pixels from the picture in the form of an array of Gmagick pixels. We can use this function to analyze the color of any picture pixel by pixel. Syntax: array Gmagick::getimagehistogram( void ) Parameters: This function doesn’t accept any parameters. Return Value: This function returns an array value containing the histogram. Exceptions: This function throws GmagickException on error. Below given programs illustrate the Gmagick::getimagehistogram() function in PHP: Program 1: php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Get the histogram $histogram = $gmagick->getimagehistogram(); print("<pre>".print_r($histogram, true)."</pre>"); ?> Output: Returns an array with 2955 Gmagick objects as members. Program 2: php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Get the histogram $histogram = $gmagick->getimagehistogram(); echo "Color of first five pixels are <br>"; for ($i = 0; $i < 5; $i++) { // Get the color of ith pixel $color = $histogram[$i]->getcolor(); echo $color . "<br>"; } ?> Output: Color of first five pixels are rgb(0, 5654, 8995) rgb(0, 6168, 9509) rgb(0, 6425, 9509) rgb(0, 7967, 11051) rgb(0, 8224, 11308) Reference: https://www.php.net/manual/en/gmagick.getimagehistogram.php Comment More infoAdvertise with us Next Article PHP | Gmagick getimagehistogram() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | Imagick getImageHistogram() Function The Imagick::getImageHistogram() function is an inbuilt function in PHP which is used to get the image histogram. Syntax: array Imagick::getImageHistogram( void ) Parameters: This function does not accept any parameter. Return Value: This function returns an array of ImagickPixel objects containing 1 min read PHP | Gmagick getimagegamma() Function 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 1 min read PHP | Gmagick getimageformat() Function The Gmagick::getimageformat() function is an inbuilt function in PHP which returns the format of an image. Syntax: string Gmagick::getimageformat( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the image format in form of string on success. Below 1 min read PHP | Gmagick getimageheight() Function The Gmagick::getimageheight() function is an inbuilt function in PHP which is used to get the image height which is the vertical length of the image. Syntax: int Gmagick::getimageheight( void ) Parameters: This function doesnât accept any parameters. Return Value: This function returns an integer va 1 min read PHP | Gmagick getImageDispose() Function The Gmagick::getImageDispose() function is an inbuilt function in PHP which is used to return the image disposal method. Syntax: int Gmagick::getImageDispose( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the dispose method on success. Below prog 1 min read PHP | Gmagick getimagewidth() Function The Gmagick::getimagewidth() function is an inbuilt function in PHP which is used to get the image width which is the horizontal length of the image. Syntax: int Gmagick::getimagewidth( void ) Parameters:This function doesnât accept any parameter. Return Value: This function returns an integer value 1 min read PHP | Gmagick getimageextrema() Function The Gmagick::getimageextrema() function is an inbuilt function in PHP which is used to get the extrema for an image. Extrema are the points at which a maximum or minimum value of a function is observed. Syntax: array Gmagick::getimageextrema( void ) Parameters:This function doesnât accept any parame 1 min read PHP | Gmagick getimageiterations() Function The Gmagick::getimageiterations() function is an inbuilt function in PHP which is used to get the image iterations. Iterations actually mean the number of times frames are shown in an image which is 0 in case of a still image and 1 in case of animation. Syntax: int Gmagick::getimageiterations( void 1 min read PHP | Imagick getImageGamma() Function The Imagick::getImageGamma() function is an inbuilt function in PHP which is used to get the Gamma value of the image. The Gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in images. Syntax: float Imagick::getImageGamma( void ) Parameters: This function does n 1 min read PHP | Gmagick getimagewhitepoint() Function The Gmagick::getimagewhitepoint() function is an inbuilt function in PHP which is used to get the chromaticity white point as an associative array with the keys "x" and "y". Syntax: array Gmagick::getimagewhitepoint( void ) Parameters:This function doesnât accepts any parameter. Return Value: This f 1 min read Like