PHP | ImagickDraw setFillColor() Function Last Updated : 30 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The ImagickDraw::setFillColor() function is an inbuilt function in PHP which is used to set the fill color to be used for drawing. Syntax: bool ImagickDraw::setFillColor( $fill_pixel ) Parameters: This function accepts single parameter $fill_pixel which is used to hold the value of pixel color. Return Value: This function does not return any value. Below programs illustrate the ImagickDraw::setFillColor() function in PHP: Program 1: php <?php // require_once('path/vendor/autoload.php'); // Create an ImagickDraw object $draw = new \ImagickDraw(); // Set stroke opacity $draw->setStrokeOpacity(1); // Set stroke color $draw->setStrokeColor('Black'); // Set stroke opacity $draw->setStrokeOpacity(0.8); // Set stroke width $draw->setStrokeWidth(10); // Set Stroke Line Join $draw->setStrokeLineJoin(Imagick::LINEJOIN_ROUND); // Set Fill Color $draw->setFillColor('lightgreen'); // Set Stroke Miter Limit $draw->setStrokeMiterLimit(40 * 12); $points = [ ['x' => 50 * 6, 'y' => 10 * 5], ['x' => 20 * 7, 'y' => 30 * 5], ['x' => 60 * 8, 'y' => 50 * 5], ['x' => 70 * 3, 'y' => 15 * 5], ]; // Draw a polygon $draw->polygon($points); // Create a new imagick object $image = new \Imagick(); // Set image dimensions $image->newImage(500, 300, 'white'); // Set the image format $image->setImageFormat("png"); // Draw the image $image->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $image->getImageBlob(); ?> Output: Program 2: php <?php // require_once('path/vendor/autoload.php'); // Create an ImagickDraw object $draw = new \ImagickDraw(); // Set the stroke color $draw->setStrokeColor('Green'); // Set Fill Color $draw->setFillColor('Red'); // Set the stroke width $draw->setStrokeWidth(7); // Draw the rectangle $draw->rectangle(40, 30, 200, 260); // Create new Imagick object $image = new \Imagick(); // Set the image dimension $image->newImage(300, 300, 'White'); // Set the image format $image->setImageFormat("png"); // Draw the image $image->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $image->getImageBlob(); ?> Output: Reference: http://php.net/manual/en/imagickdraw.setfillcolor.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setFillColor() Function sarthak_ishu11 Follow Improve Article Tags : Technical Scripter Web Technologies PHP Image-Processing PHP-function PHP-Imagick +2 More Similar Reads PHP | GmagickDraw setfillcolor() Function The GmagickDraw::setfillcolor() function is an inbuilt function in PHP which is used to set the fill color to be used for drawing. Syntax: GmagickDraw GmagickDraw::setfillcolor( mixed $color ) Parameters: This function accepts a single parameter $color which is used to hold the value of pixel color. 2 min read PHP | ImagickDraw setFillRule() Function The ImagickDraw::setFillRule() function is an inbuilt function in PHP which is used to set the fill rule to use while drawing the polygons. Syntax: bool ImagickDraw::setFillRule( int $fill_rule ) Parameters: This function accepts a single parameter $fill_rule which holds an integer value correspondi 2 min read PHP | ImagickDraw setFillAlpha() Function The ImagickDraw::setFillAlpha() function is an inbuilt function in PHP which is used to set the opacity to use when drawing using the fill color or fill texture. Syntax: bool ImagickDraw::setFillAlpha( float $opacity ) Parameters: This function accepts a single parameter $opacity which holds the opa 2 min read PHP | ImagickDraw setFillOpacity() Function The ImagickDraw::setFillOpacity() function is an inbuilt function in PHP which is used to set the opacity to use when drawing using the fill color or fill texture.Syntax:Â bool ImagickDraw::setFillOpacity( $fillOpacity ) Parameters: This function accepts a single parameter $fillOpacity which is used 2 min read PHP | ImagickDraw setStrokeColor() Function The ImagickDraw::setStrokeColor() function is an inbuilt function in PHP which is used to set the color used for stroking object outlines. Syntax: bool ImagickDraw::setStrokeColor( $stroke_pixel ) Parameters: This function accepts a single parameter $stroke_pixel which is used to hold the color valu 2 min read PHP | ImagickDraw setFont() Function The ImagickDraw::setFont() function is an inbuilt function in PHP which is used to set the fully-specified font to use when annotating with text. Syntax: bool ImagickDraw::setFont( $font_name ) Parameters: This function accepts a single parameter $font_name which is used to hold the value of font na 2 min read PHP | ImagickDraw setClipRule() Function The ImagickDraw::setClipRule() function is an inbuilt function in PHP which is used to set the polygon fill rule to be used by the clipping path. This usually doesn't have any impact on the final image but still provides different FILLRULE methods to complete the same task. Syntax: bool ImagickDraw: 2 min read PHP | ImagickDraw setTextUnderColor() Function The ImagickDraw::setTextUnderColor() function is an inbuilt function in PHP which is used to set the color of a background rectangle to place under text annotations. Syntax: bool ImagickDraw::setTextUnderColor( $under_color ) Parameters: This function accepts a single parameter $under_color which is 2 min read PHP | ImagickDraw setFillPatternURL() Function The ImagickDraw::setFillPatternURL() function is an inbuilt function in PHP which is used to set the URL to use as a fill pattern for filling objects. The URL actually is a unique name of a pattern with a '#' before the name. Syntax: bool ImagickDraw::setFillPatternURL( string $fill_url ) Parameters 2 min read PHP | GmagickDraw setfillopacity() Function The GmagickDraw ::setfillopacity() function is an inbuilt function in PHP which is used to set the opacity of a drawing image. It is used when drawing the image using the filled color or filled texture. Syntax: public GmagickDraw::setfillopacity( $fill_opacity ) : GmagickDraw Parameters: This functi 2 min read Like