PHP | GmagickPixel setcolor() function Last Updated : 23 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The GmagickPixel::setcolor() function is an inbuilt function in PHP which is used to set the color of the GmagickPixel object. Syntax: GmagickPixel GmagickPixel::setcolor( string $color ) Parameters:This function accepts a single parameter $color which holds the color. Return Value: This function returns GmagickPixel object on success. Exceptions: This function throws GmagickPixelException on error. Below given programs illustrate the GmagickPixel::setcolor() function in PHP: Program 1: php <?php // Create a new gmagickPixel object $gmagickPixel = new GmagickPixel(); // Set the color $gmagickPixel->setColor('#428554'); // Get the color $color = $gmagickPixel->getColor(); print("<pre>".print_r($color, true)."</pre>"); ?> Output: rgb(16962, 34181, 21588) Program 2: php <?php // Create a new Gmagick object // https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png $gmagick = new Gmagick('geeksforgeeks.png'); // Create a new GmagickPixel object $gmagickPixel = new GmagickPixel(); // Set the color $gmagickPixel->setcolor('blue'); // Create a GmagickDraw object $draw = new GmagickDraw(); // Set fill color using gmagickpixel $draw->setfillcolor($gmagickPixel); // Set the font size $draw->setfontsize(40); // Annotate a text $draw->annotate(50, 180, 'GeeksforGeeks'); // Use of drawimage function $gmagick->drawImage($draw); // Display the output image header("Content-Type: image/png"); echo $gmagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/gmagickpixel.setcolor.php Comment More infoAdvertise with us Next Article PHP | ImagickPixel setColor() function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | ImagickPixel setColor() function The ImagickPixel::setColor() function is an inbuilt function in PHP which is used to set the color of the ImagickPixel object. Syntax: bool ImagickPixel::setColor( string $color ) Parameters:This function accepts a single parameter $color which holds the color. Return Value: This function returns TR 1 min read PHP | GmagickPixel setcolorvalue() Function The GmagickPixel::setcolorvalue() function is an inbuilt function in PHP which is used to set the normalized value of the provided color channel for a given GmagickPixelâs color. The normalized value is a floating-point number between 0 and 1.Syntax:Â GmagickPixel GmagickPixel::setcolorvalue( int $co 2 min read PHP | ImagickPixel setColorValue() function The ImagickPixel::setColorValue() function is an inbuilt function in PHP which is used to set the normalized value of the provided color channel for a given ImagickPixel's color. The normalized value is a floating-point number between 0 and 1. Syntax: bool ImagickPixel::setColorValue( int $color, fl 2 min read 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 | ImagickPixel setColorValueQuantum() function The ImagickPixel::setColorValueQuantum() function is an inbuilt function in PHP which is used to set the value of the provided color channel for a given ImagickPixel's color. The value can be in a range from 0 to 65535. Syntax: bool ImagickPixel::setColorValueQuantum( int $color, float $value ) Para 2 min read PHP | Gmagick setimagecolorspace() Function The Gmagick::setimagecolorspace() function is an inbuilt function in PHP which is used to set the image colorspace. Syntax: Gmagick Gmagick::setimagecolorspace( int $colorspace ) Parameters: This function accepts a single parameter $colorspace which holds an integer corresponding to one of COLORSPAC 1 min read Like