PHP | GmagickPixel __construct() Function Last Updated : 29 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The GmagickPixel::__construct() function is an inbuilt function in PHP which is used to construct an GmagickPixel object. If a color is specified, the object is constructed and then initialized with that color before being returned. Syntax: GmagickPixel GmagickPixel::__construct( string $color ) Parameters: This function accepts a single parameter $color which is optional and 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::__construct() function in PHP: Program 1 (Without color parameter): php <?php // Create a new GmagickPixel // object using __construct $gmagickPixel = new GmagickPixel(); // Get the color $color = $gmagickPixel->getcolor(); echo $color; ?> Output: rgb(0, 0, 0) Program 2 (With color parameter): php <?php // Create a new GmagickPixel object // using __construct $gmagickPixel = new GmagickPixel('#ccb062'); // Get the color $color = $gmagickPixel->getcolor(); echo $color; ?> Output: rgb(52428, 45232, 25186) Reference: https://www.php.net/manual/en/gmagickpixel.construct.php Comment More infoAdvertise with us Next Article PHP | Gmagick current() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | ImagickPixel __construct() Function The ImagickPixel::__construct() function is an inbuilt function in PHP which is used to construct an ImagickPixel object. If a color is specified, the object is constructed and then initialized with that color. Syntax: bool ImagickPixel::__construct( void ) Parameters: This function accepts a single 2 min read PHP | Gmagick __construct() Function The Gmagick::__construct() function is an inbuilt function in PHP which is used to create a Gmagick object. Further Gmagick manipulations can be done with this newly created Gmagick object. Syntax: public Gmagick::__construct( string $filename ) Parameters: This function accepts a single parameter $ 1 min read PHP | Gmagick current() Function The Gmagick::current() function is an inbuilt function in PHP which is used to return the reference of the current Gmagick object. This function does not create any copy but returns the same instance of Gmagick. Syntax: Gmagick Gmagick::current( void ) Parameters: This function doesnât accept any pa 1 min read PHP | Gmagick destroy() Function The Gmagick::destroy() function is an inbuilt function in PHP which is used to destroy the Gmagick object and frees all resources associated with it. Syntax: bool Gmagick::destroy( void ) Parameters: This function doesnât accept any parameter. Return Value: This function returns TRUE on success. Exc 1 min read PHP | Gmagick clear() Function The Gmagick::clear() function is an inbuilt function in PHP which is used to clear all resources associated to Gmagick object. Syntax: Gmagick Gmagick::clear( void ) Â Parameters: This function does not accepts any parameter. Return Value: This function returns the cleared Gmagick object. Errors/Exc 2 min read PHP | GmagickPixel setcolor() function 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 re 1 min read Like