Open In App

PHP | Gmagick getimagemattecolor() Function

Last Updated : 21 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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
<?php

// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');

// Get the matte color
$colorPixel = $gmagick->getimagemattecolor();
echo $colorPixel->getcolor();
?>
Output:
rgb(48573, 48573, 48573)
Program 2: php
<?php

// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');

// Set the matte color
$gmagick->setimagemattecolor('green');

// Get the matte color
$colorPixel = $gmagick->getimagemattecolor();
echo $colorPixel->getcolor();
?>
Output:
rgb(0, 32896, 0)
Reference: https://www.php.net/manual/en/gmagick.getimagemattecolor.php

Next Article

Similar Reads