PHP | Gmagick getimagemattecolor() Function
Last Updated :
21 Jan, 2020
The Gmagick::getimagemattecolor() function is an inbuilt function in PHP which is used to get the image matte color.
Syntax:
GmagickPixel Gmagick::getimagemattecolor( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns a GmagickPixel object containing the color of matte.
Exceptions: This function throws GmagickException on error.
Below given programs illustrate the Gmagick::getimagemattecolor() function in PHP:
Used Image:
Program 1:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$colorPixel = $gmagick ->getimagemattecolor();
echo $colorPixel ->getcolor();
?>
|
Output:
rgb(48573, 48573, 48573)
Program 2:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$gmagick ->setimagemattecolor( 'green' );
$colorPixel = $gmagick ->getimagemattecolor();
echo $colorPixel ->getcolor();
?>
|
Output:
rgb(0, 32896, 0)
Reference: https://www.php.net/manual/en/gmagick.getimagemattecolor.php
Share your thoughts in the comments
Please Login to comment...