PHP | ImagickPixel getColorValue() function Last Updated : 16 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The ImagickPixel::getColorValue() function is an inbuilt function in PHP which is used to get 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: float ImagickPixel::getColorValue( int $color ) Parameters:This function accepts a single parameter $color which holds 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) Return Value: This function returns an float value containing the normalized value of the color value. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickPixel::getColorValue() function in PHP: Program 1: php <?php // Create a new imagickPixel object $imagickPixel = new ImagickPixel('#ad4c45'); // Get the Color value with imagick::COLOR_RED $colorValue = $imagickPixel->getColorValue(imagick::COLOR_RED); echo $colorValue; ?> Output: 0.67843137254902 Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Get the image histogram $histogramElements = $imagick->getImageHistogram(); // Get the 301th pixel $getPixel = $histogramElements[300]; // Get the Color value with imagick::COLOR_GREEN $colorValue = $getPixel->getColorValue(imagick::COLOR_GREEN); echo $colorValue; ?> Output: 0.29803921568627 Reference: https://www.php.net/manual/en/imagickpixel.getcolorvalue.php Comment More infoAdvertise with us Next Article PHP | ImagickPixel getColorValue() function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | GmagickPixel getcolorvalue() Function The GmagickPixel::getcolorvalue() function is an inbuilt function in PHP which is used to get the normalized value of the provided color channel for a given GmagickPixel color. The normalized value is a floating-point number between 0 and 1. Syntax: float GmagickPixel::getcolorvalue( int $color ) Pa 2 min read PHP | ImagickPixel getColor() Function The ImagickPixel::getColor() function is an inbuilt function in PHP which is used to get the color described by the ImagickPixel object, as an array. If the color has an opacity channel set, this is provided as a fourth value in the list. Keys of the array are r is (red), b is (blue), g is (green) a 2 min read PHP | ImagickPixel getColorValueQuantum() function The ImagickPixel::getColorValueQuantum() function is an inbuilt function in PHP which is used to get the normalized value of the provided color channel for a given ImagickPixel's color. The normalized value lies in the quantum range where 65535 is maximum and 0 is lowest on contrary to getColorValue 2 min read PHP | ImagickPixel getColorCount() function The ImagickPixel::getColorCount() function is an inbuilt function in PHP which is used to get the color count associated with the pixel color. A color count is the number of pixels in the image that have the same color as this ImagickPixel. getColorCount() appears to only work for ImagickPixel objec 2 min read PHP | ImagickPixel getColorQuantum() Function The ImagickPixel::getColorQuantum() function is an inbuilt function in PHP which is used to get the color of the pixel in an array as Quantum values. This function returns an array with keys r, g, b and an each stands for red, green, blue and alpha/opacity respectively. Quantum value ranges from 0 t 2 min read Like