What is the difference of HISTOGRAM-VALUE, LUMINANCE, RGB?

Hi,
In the document of gimp-drawable-curve-spline in the procedure browser there are the following parameters.
HISTOGRAM-VALUE (0), HISTOGRAM-RED (1), HISTOGRAM-GREEN (2), HISTOGRAM-BLUE (3), HISTOGRAM-ALPHA (4), HISTOGRAM-LUMINANCE (5), HISTOGRAM-RGB (6)

But what is the difference between HISTOGRAM-VALUE, HISTOGRAM-LUMINANCE, HISTOGRAM-RGB?

I suppose HISTOGRAM-LUMINANCE may be a greyscale value based on weighted R, G, B value, and the others, one may be mean value of RGB, and the other may be max(R, G, B). But which is which?

“Value” likely comes from HSV.

On Luminance and other intensities, please refer to:

There is quite a lot of confusion regarding intensities and colour models, so I hope this reference does not contain any misinformation…

1 Like

AFAIK “value” is max of R/G/B, luminance is a weighted addition of R/G/B, and RGB is an error (only usable with the interactive plugin).

1 Like

Thanks a lot!

Thank you!

Value is max(R,G,B)

Luminance is weighted sum, approx (0.3R+0.6G+0.1B).

RGB is three separate curves R,G,B - not an error.

RGB is three separate curves R,G,B - not an error.

It’s an error when using the API, that can only return data for one channel.

  • HISTOGRAM_VALUE works
>>> pdb.gimp_drawable_histogram(layer,HISTOGRAM_VALUE, 0., 1.)
(0.0, 0.0, 0.0, 8754.952965072822, 8754.952965072822, 1.0)
  • HISTOGRAM_RGB fails
>>> pdb.gimp_drawable_histogram(layer,HISTOGRAM_RGB, 0., 1.)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'HISTOGRAM_RGB' is not defined
  • There are indeed only six HISTOGRAM_* constants defined
>>> [h for h in dir() if 'HISTOGRAM' in h]
['HISTOGRAM_ALPHA', 'HISTOGRAM_BLUE', 'HISTOGRAM_GREEN', 'HISTOGRAM_LUMINANCE', 'HISTOGRAM_RED', 'HISTOGRAM_VALUE']
  • Fun thing, you can use "6" as a channel value and get something (but still data for a single channel)
>>> pdb.gimp_drawable_histogram(layer,6, 0., 1.)
(0.0, 0.0, 0.0, 26264.858895218465, 26264.858895218465, 1.0)

Using '6` on a very plain layer returns a pixel count 3 times the pixel count of the layer so it could be a histogram done on all three channels combined.

The 3.0 API still only documents 6 values.

Sorry, I was talking about the GUI, not the coding thereof.

I have tested gimp-drawable-curves-spline with these parameters. gimp-drawable-curves-spline accepts HISTOGRAM-VALUE, -RED, -GREEN, -BLUE, ーALPHA, but it rejects HISTOGRAM-LUMINANCE, and -RGB. It generates error message “global name ‘HISTOGRAM_RGB’ is not defined” etc.