PHP | ImagickPixel isSimilar() function
The ImagickPixel::isSimilar() function is an inbuilt function in PHP which is used to check the distance between the color described by this ImagickPixel object and that of the provided object, by plotting their RGB values on the color cube. If the distance between the two points is less than the fuzz value given, the colors are similar.
bool ImagickPixel::isSimilar( ImagickPixel $color, float $fuzz )
Parameters:This function accepts two parameters as mentioned above and described below:
- $color: It specifies the pixel containing the color to be compared with.
- $fuzz: It specifies the fuzz value which tells the maximum distance within which to consider these colors as similar.
Return Value: This function returns an bool value which tells whether colors are similar (true) or not (false).
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the ImagickPixel::isSimilar() function in PHP: