The imagecolorexact() function is an inbuilt function in PHP which is used to get the index of specified color in the palette of the image. In created image files only used colors in the image are resolved. Colors present only in the palette are not resolved.
int imagecolorexact ( $image, $red, $green, $blue )
Parameters: This function accepts four parameters as mentioned above and described below:
- $image: It is returned by one of the image creation functions, such as imagecreatetruecolor(). It is used to create size of image.
- $red: This parameter is used to set value of red color component.
- $green: This parameter is used to set value of green color component.
- $blue: This parameter is used to set value of blue color component.
Return Value: This function returns the index of the specified color in the palette on success, or -1 if the color does not exist.
Below programs illustrate the imagecolorexact() function in PHP.
Array (  => 659220  => 2012230  => 800537  => 10098996 )
Array (  => 39168  => 0  => 16777215  => 6579252 )