The imagecolorresolve() function is an inbuilt function in PHP which is used to get the index of the specified color or its closest possible alternative color. This function returns a color index value for a requested color, either the exact matched color or the closest possible alternative.
int imagecolorresolve ( $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 color index.
Below programs illustrate the imagecolorresolve() function in PHP:
Array (  => 187  => 188  => 189  => 190 )
Array (  => 10223871  => 65480  => 1082915  => 9437182 )
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.