PHP | GmagickPixel setcolorvalue() Function Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 $color, float $value ) Parameters: This function accepts two parameters as mentioned above and described below: $color: It specifies an integer which corresponds to one of COLOR constants.List of all COLOR constants are given below: imagick::COLOR_BLACK (11)imagick::COLOR_BLUE (12)imagick::COLOR_CYAN (13)imagick::COLOR_GREEN (14)imagick::COLOR_RED (15)imagick::COLOR_YELLOW (16)imagick::COLOR_MAGENTA (17)imagick::COLOR_OPACITY (18)imagick::COLOR_ALPHA (19)imagick::COLOR_FUZZ (20)$value: It specifies the value.Return Value: This function returns GmagickPixel object on success.Exceptions: This function throws GmagickPixelException on error.Below given programs illustrate the GmagickPixel::setcolorvalue() function in PHP:Program 1: php <?php // Create a new gmagickPixel object $imagickPixel = new GmagickPixel(); // Set the color value $imagickPixel->setColorValue(gmagick::COLOR_RED, 0.8); // Get the Color value with gmagick::COLOR_RED $colorValue = $imagickPixel->getcolorvalue(gmagick::COLOR_RED); echo $colorValue; ?> Output: 0.8 Used Image: Program 2: php <?php // Create a new gmagickPixel object $imagickPixel = new GmagickPixel(); // Create a new Gmagick object $gmagick = new Gmagick('geeksforgeeks.png'); // Create a new GmagickPixel object $gmagickPixel = new GmagickPixel(); // Set the color to red $gmagickPixel->setcolor('red'); // Set the color value of red to 0.5 for light red $gmagickPixel->setcolorvalue(gmagick::COLOR_RED, 0.5); // 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(180, 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.setcolorvalue.php Comment More infoAdvertise with us Next Article PHP | ImagickPixel setColorValueQuantum() function K kartik Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads 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 | 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 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 | 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 | Imagick setColorspace() Function The Imagick::setColorspace() function is an inbuilt function in PHP which is used to set the global colorspace value of an image. Syntax: bool Imagick::setColorspace( int $colorspace ) Parameters: This function accepts a single parameter $colorspace which holds an integer value corresponding to one 1 min read PHP | ImagickPixel setHSL() function The ImagickPixel::setHSL() function is an inbuilt function in PHP which is used to set the color described by the ImagickPixel object using normalized values for hue, saturation and luminosity. Syntax: bool ImagickPixel::setHSL( float $hue, float $saturation, float $luminosity ) Parameters:This func 2 min read Like