Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

PHP | GmagickDraw getfillcolor() function

  • Last Updated : 23 Jan, 2020

The GmagickDraw::getfillcolor() function is an inbuilt function in PHP which is used to get the fill color used for drawing filled objects.


GmagickPixel GmagickDraw::getfillcolor( void )

Parameters:This function doesn’t accept any parameter.

Return Value: This function returns GmagickPixel fill color used for drawing filled objects.

Exceptions: This function throws GmagickDrawException on error.

Below given programs illustrate the GmagickDraw::getfillcolor() function in PHP:


// Create a new GmagickDraw object 
$draw = new GmagickDraw(); 
// Set the fill color
// Get the fill color 
$colorPixel = $draw->getfillcolor(); 
$color = $colorPixel->getcolor();
echo $color


rgb(0, 0, 65535)


// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
// Create a GmagickDraw object
$draw = new GmagickDraw();
// Set the color
// Draw rectangle for background
$draw->rectangle(-10, -10, 800, 400);
// Set the fill color
// Set the font size
// Annotate a text
$draw->annotate(50, 50, 'The fill color here is ' . $draw->getFillColor()->getcolor());
// Set the fill color
// Annotate a text
$draw->annotate(50, 100, 'The fill color here is ' . $draw->getFillColor()->getcolor());
// Use of drawimage functeannotate
// Display the output image
header("Content-Type: image/png");
echo $gmagick->getImageBlob();



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!