Checks 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. This method replaces ImagickPixel::isSimilar() and correctly normalises the fuzz value to ImageMagick QuantumRange.

A distance of '1' is the maximum distance in the color space e.g. from 0, 0, 0 to 255, 255, 255 in RGB color space.

The only difference between ImagickPixel::isSimilar and ImagickPixel::isPixelSimilar is that isSimilar needs to be scaled by the quantum value.


Color 1 Color 2 Test distance * 255 Is within distance
rgb(245, 0, 0) rgb(255, 0, 0) 5.1961524227066 no
rgb(245, 0, 0) rgb(255, 0, 0) 5.7735026918963 yes
rgb(0, 0, 0) rgb(7, 7, 0) 5.1961524227066 no
rgb(0, 0, 0) rgb(7, 7, 0) 5.7735026918963 yes
rgba(0, 0, 0, 1) rgba(7, 7, 0, 1) 5.1961524227066 no
rgba(0, 0, 0, 1) rgba(7, 7, 0, 1) 5.7735026918963 yes
rgb(128, 128, 128) rgb(128, 128, 120) 4.0414518843274 no
rgb(128, 128, 128) rgb(128, 128, 120) 4.618802153517 yes
rgb(0, 0, 0) rgb(255, 255, 255) 254.9 no
rgb(0, 0, 0) rgb(255, 255, 255) 255 yes
rgb(255, 0, 0) rgb(0, 255, 255) 254.9 no
rgb(255, 0, 0) rgb(0, 255, 255) 255 yes
black rgba(0, 0, 0) 0 yes
black rgba(10, 0, 0, 1.0) 5.7735026918963 yes
Checks 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. This method replaces ImagickPixel::isSimilar() and correctly normalises the fuzz value to ImageMagick QuantumRange.

A distance of '1' is the maximum distance in the color space e.g. from 0, 0, 0 to 255, 255, 255 in RGB color space.

The only difference between ImagickPixel::isSimilar and ImagickPixel::isPixelSimilar is that isSimilar needs to be scaled by the quantum value.

Parameters
colorImagickPixelThe ImagickPixel object to compare this object against.
fuzzfloatThe maximum distance within which to consider these colors as similar. The theoretical maximum for this value is the square root of three (1.732).