# How do I interpret individual colors on RGB histogram?

I know how to read the Luminosity histogram and I thought that I knew how to read RGB histogram as well, until I saw the following example:

The RGB histogram shows exactly the same 3 'spikes'. What are these? I can tell that they all come from the same 'sky' source, but why aren't they on the same horizontal place?

-

Simple: the color of the sky is comprised of the mix of all three channels. If it were gray, there would be equal amounts of red, green, and blue. It's not, though — there's a lot more blue, a little less green, and very little red. Pretty much like this:

Check out how the arrows on the slider are pretty much exactly at the same percentages as the spikes in your histogram.

If you put the sliders all in the same place...

...the histogram lines would coincide, but your color would change...

...to dark gray instead of the kind of teal it was in your sample image.

Here's a representation of the digital form of this file. Each pixel is a triad of `(red,green,blue)`, so a teal pixel is represented as`( 28,123,142)`. Because there's only so much room to type, I'm making this very low resolution but you should get the idea. Here, the values go from 0 to 255.

``````( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  (201,201,201)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
``````

This ends up looking like this tiny little thing:

I don't have the same software you do, but load it in to your program and look at the histogram. The histogram just shows a graphical representation of the counts of each channel at each level. You should see a little bump over to the middle right representing the gray dot, and then spikes at 28 for red, 123 for green, and 142 for blue. Here's what it looks like in the software I have:

The image doesn't look very red, and it's not. But what red there is is clustered all in that one color, and that's a huge percentage of the image, so you get a spike.

This is a rather technical tool, and while it can be very useful, it doesn't show a nice perceptual map of the colors in the image. That would be a different visualization.

Something that might be more like what you want is called a "3D Color Histogram". The Color Inspector Plugin for ImageJ does this, as does the windows-only program Colorspace, or you can use this web site: http://3dhistogram.com — which I just discovered and which looks pretty nifty (and no-hassle) but is maybe more cool than useful.

In the discussion in the comments below this answer, ClarityForce points out Tyler Neylon's nice open-source implementation of Hue Histograms. There's a "traditional" histogram, a pie chart, and a combined version. The combined version looks great with many real images, but is not so impressive with the sample of the moon image cropped from the one posted in the question. Here's the hue histogram and pie chart from that, though:

And, just for fun, here's the three types of hue charts it can make for the Mona Lisa:

-
I understand that the color of the sky is a mix of RGB channels and that there is very little Red in that color. However, according to the histogram there should be a big amount of red (the spike is tall) and it should be almost black (the spike is on the left side). By looking on the picture I still can't see anything like that and I still don't understand how to interpret the histogram :( – user9292 Apr 4 '12 at 17:11
@ClarityForce: take a look at the sliders I've posted. There is a very large amount of that almost-black red. It's a component of the teal color. – mattdm Apr 4 '12 at 17:14
Thank you for the update! Are you sure that the alignment of arrows is not just a pure coincidence? I thought that the horizontal position on the histogram should represent the tonal range, or brightness and not the color itself. If it's really the case, I would say that the RGB histogram is pretty much useless :( – user9292 Apr 4 '12 at 17:19
I think I see the misunderstanding... don't think of the the spike as red "contributing darkness", but rather as red not contributing much to the brightness. The height of the spike represents the number of pixels in which the red value is a very small component of the color. Unlike the composite (luminance) histogram, the individual channels don't tell you a lot about the overall brightness, just the proportions of the color channels distributed in the scene. It can tell you about individual channel clipping and gross color shifts, but it doesn't directly reflect tonality. – user2719 Apr 4 '12 at 17:24
@mattdm Thanks for the link! I have also accidentally found this: blog.zillabyte.com/color-as-data and this: blog.zillabyte.com/hue-histograms – user9292 Apr 4 '12 at 21:24

I decomposed your image into its component colors in the GIMP with Color | Components | Decompose, to Color model: RGB and with 'Decompose to layers' checked. When I look at the individual layers, this is what I see:

I guess that the bulk of each "color" is going into painting the background; the red layer is making the background all-black, which is why the spike is so far to the left, and the green and blue layers are more mid-grays. But... that's just a guess.

A more interesting histogram for you might require removing the background. I selected just the moon (by drawing a circle with the Ellipse tool), inverted the selection (Select | Invert), enabled transparency for the image with Layer | Transparency | Add Alpha Channel, and then pressed the Delete key to delete all the background. Now I get this histogram of just the moon:

-