Histograms 2 - The other color modes

Histograms part 2: The other color modes

The two questions


The first article about histograms explained the mechanics of what is a simple graph showing the tonal distribution of an image. The histogram itself and the user interface of Photoshop’s Histogram window were turned inside out, so to say. But all of that piece applied to RGB-coded images only. Other ways of coding exist: CMYK, LAB and Grayscale being the most important ones. Does Photoshop support histograms for these as well, and if so, how are they constructed?


The answer to the first question is: yes, histograms can be shown in all of these color spaces. To answer the second question – how are they constructed – is the purpose of this article.


CMYK


Let’s grasp the nettle, open an image and convert to CMYK. Menu: Image – Mode – CMYK color. I did this for the image of figure 1. If you get a warning about the CMYK profile, ignore that and just click OK. Open the Histogram panel and show the All Channels View. Figure 2 shows the result.

Pink flowers

Figure 1. Example image

Probably the quickest way to understand the mechanics of the CMYK histograms is to look at the Black channel. Figure 3 shows it, and the bottom histogram of figure 2 is what represents it. Note two pecularities:


  • The black channel is light overall, and completely white in about half the image
  • The histogram is stuck to the right.


This leads to our first observation. In the CMYK histograms, a value of ‘0’ – no ink - is plotted on the right of the histogram graph. A value of ‘100’ – maximum ink – comes on the very left of the graph.


Sounds logical?


The match with RGB histograms is that the lighter the component’s value, the more to the right it’s shown on the graph. The lighter, the righter. In RGB, that’s the same. But in RGB, more to the right also means: more color. In CMYK, it means less color.

Figure 3. Black channel of figure 1

Figure 2. CMYK histograms for figure 1

Another surprising aspect of the CMYK histograms is the mismatch between channel values (ranging from 0 to 100) and the X axis of the histogram (between 0 and 255). If I want to know – a hypothetical and pretty useless question, but why not – how many pixels contain Cyan 25% exactly, the histogram won’t tell me. I can click on the Cyan graph and find out that 58,203 pixels have C value 191 (being about 75% of 255) but that's not the same as 25 on a scale from 100 to 0.


It may be that Photoshop’s internal representation of CMYK is simply 8-bit – hence, ranging from 0 to 255. Only when data needs to be output, to a printer for example, it is converted to the 0-100 scale. Just guessing here.


LAB

Enough about CMYK. Let’s continue to LAB. Menu: Image – Mode – LAB color. Look again at the All Channels view of the Histogram: figure 4.


These histograms are pretty straightforward. In all cases, the lowest channel values are on the left of the graph. For L (Lightness), that’s value 0 which is black. For A, it’s the maximum possible negative which is an extremely strong green. For B, it’s the most possible blue.


You’ll understand what comes on the right then. For the L, it’s white. On A, a screaming magenta. B, a blinding yellow.


Interestingly, for an image coded in LAB, the Histogram menu contains the action "Show Channels in Color" but it has no effect. LAB's histograms are always shown in black.


Knowing that the extreme values of A and B are never reached in normal photographs, their histograms always peak somewhere in the middle and have short tails on either sides. It doesn’t make sense to try to fix this and induce full range for these channels. For that reason, the A and B histograms are not of much value.


Even less useful is the histogram for Composite. This is a representation of the three channels somehow totalled up. Doing that for three channels that are so different in function (one for luminosity only, two for color only) is a useless exercise in my opinion. Mathematically, one could explain what is shown at any point of this graph, but it doesn’t have a meaningful relationship to the image itself.


Grayscale


Not much needs to be said about this color mode. Switching to it discards all color information and makes the image one-channel only. The histogram behaves like any of the R, G and B histograms, and also like LAB’s L. Light values on the right, darks on the left.

Figure 4. LAB histograms for figure 1

The menu of the Histogram panel shows an action “All Channels View”, but as there is only one channel, it’s not different from the “Expanded View”.


The summit of weirdness is the menu action "Show Channels in Color" on a Grayscale image. When unchecked, the histogram is shown in Black. Otherwise, it's shown in Red (!). Why they chose Red is beyond me. Although, admittedly, all things considered, the menu action works as advertized.


Some words about the Stats


In the Histogram menu, make sure that “Show Statistics” is checked. In Expanded and All Channels view, the panel will show a lot of numbers. None of these are of much interest for anyone having to adjust or assess an image, but as I’m writing “Photoshop by the Numbers”, let me go through them anyway. See figure 5 for an example.

Figure 5. Example stats for the Cyan channel

  • Mean: the average pixel value of the current histogram. Let’s assume we are looking at the histogram for the Cyan channel, full image. The mean is then the sum of all Cyan pixel values (on a scale of 0 for full coverage to 255 for no coverage), divided by the total number of pixels.
  • Std Dev: standard deviation. A measure for the variation amongst pixel values. A contrasty channel has a higher standard deviation than a flat one.
  • Median: the “middle” pixel value. In our example, the panel shows 176. This means that the  number of pixels with Cyan value lower than 176 is 50% (or close to) and idem for the number of pixels above 176.
  • Pixels: the total number of pixels of the image (or the selected image area).


When you click in the histogram (either a one-click or click-and-drag - see the red bar in figure 5), some values on the right column are shown in addition. These are:


  • Level: the pixel value that you clicked on (or values if you dragged to select a range).
  • Count: the number of pixels having the selected value(s).
  • Percentile: the percentage of pixels having the selected value(s). This is the result of the simple formula (Count / Pixels) * 100.


Last but not least, there is:


  • Cache Level: when 1, the histogram is based on the full image. When higher, it’s based on sampled areas, to speed up display refresh. See the explanation in my first article on histograms.


Significant objects and real detail


I must admit, I struggled to stay motivated finishing this article, not because it’s difficult material but because it's ultimately not very relevant at all. Yes, there's a lot of numbers and math going on under the hood of the Histogram panel, so it should interest me, but really not much of it is useful when working with a digital image. Let me finish my piece with a much more meaningful paragraph from the “Modern Photoshop Color Workflow” book by Dan Margulis, in the middle of a brilliant explanation of the Equalize command:


“Unless and until the histogram can learn what pixels represent significant objects, and can distinguish noise from real detail, it will remain an inadequate alternative to opening your eyes and looking at the screen.”


Gerald Bakker, 26 October 2017



Related articles

Photoshop by the Numbers