Re: Feedback on first pushed commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/28/2017 04:35 AM, Marco Ciampa via gimp-docs-list wrote:

Is this right?

src/menus/colors/desaturate/desaturate.xml:108(phrase)

        <para>The shades of gray will be calculated as</para>
          <informalequation>
            <mediaobject>
              <textobject>
                <phrase>
                  Lightness (HSL)) = &frac12; &times; (max(R,G,B) + min(R,G,B))
                </phrase>
              </textobject>
            </mediaobject>
          </informalequation>
        </listitem>


If you mean the formula for Lightness, it's correct:

From 2.8 docs:
Lightness

    The graylevel will be calculated as
    Lightness = ½ × (max(R,G,B) + min(R,G,B))

From posted 2.9 docs:
Lightness (HSL)

    The shades of gray will be calculated as
    Lightness (HSL)) = ½ × (max(R,G,B) + min(R,G,B))

From Wikipedia (https://en.wikipedia.org):
In the HSL "bi-hexcone" model, lightness is defined as the average of the largest and smallest color components (fig. 12c).

From GIMP code (app/operations/gimpoperationdesaturate.c):
    case GIMP_DESATURATE_LIGHTNESS:
      /* This is the formula for Lightness in the HSL "bi-hexcone"
       * model: https://en.wikipedia.org/wiki/HSL_and_HSV
       */
      while (samples--)
        {
          gfloat min, max, value;

          max = MAX (src[0], src[1]);
          max = MAX (max, src[2]);
          min = MIN (src[0], src[1]);
          min = MIN (min, src[2]);

          value = (max + min) / 2;

Not to be confused with LAB/LCH Lightness, which is calculated from XYZ, not from RGB (http://brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html).

Best,
Elle
_______________________________________________
gimp-docs-list mailing list
gimp-docs-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gimp-docs-list




[Index of Archives]     [Video For Linux]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [Scanners]     [GEGL]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux