The
GmagickPixel::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 GmagickPixel. The
getcolorcount() appears to only work for GmagickPixel objects created through
getimagehistogram() function.
Syntax:
int GmagickPixel::getcolorcount( void )
Parameters: This function doesn’t accept any parameters.
Return Value: This function returns an integer containing the color count.
Exceptions: This function throws GmagickPixelException on error.
Below given programs illustrate the
GmagickPixel::getcolorcount() function in PHP:
Used Image:
👁 Image
Program 1:
Output:
100064
Program 2:
Output:
1
Program 3:
Output:
R G B Hue :Count
0 22 35 :1
0 24 37 :1
0 25 37 :1
0 31 43 :1
0 32 44 :1
0 33 45 :1
0 36 48 :1
0 37 49 :3
.
.
.
Reference: https://www.php.net/manual/en/gmagickpixel.getcolorcount.php