Function

Gimpcolor_is_perceptually_identical

since: 3.0

Declaration [src]

gboolean
gimp_color_is_perceptually_identical (
  GeglColor* color1,
  GeglColor* color2
)

Description [src]

Determine whether color1 and color2 can be considered identical to the human eyes, by computing the distance in a color space as perceptually uniform as possible.

This function will also consider any transparency channel, so that if you only want to compare the pure color, you could for instance set both color’s alpha channel to 1.0 first (possibly on duplicates of the colors if originals should not be modified), such as:

gimp_color_set_alpha (color1, 1.0);
gimp_color_set_alpha (color2, 1.0);
if (gimp_color_is_perceptually_identical (color1, color2))
  {
    printf ("Both colors are identical, ignoring their alpha component");
  }

Note that this relation is not transitive, because it is based on a color distance algorithm. It means that if color1 is perceptually identical to color2, which is perceptually identical to color3, it does not mean that color1 is perceptually identical to color3, as far this algorithm is concerned.

Available since: 3.0

Parameters

color1

Type: GeglColor

A GeglColor

The data is owned by the caller of the function.
color2

Type: GeglColor

A GeglColor

The data is owned by the caller of the function.

Return value

Type: gboolean

Whether the 2 colors can be considered the same for the human eyes.