histograms

August 31st, 2013
could someone explain to me in relatively simple terms how to read a colour histogram? i think i understand histograms generally - especially if in black and white... but i am totally lost in colour... what does it mean when the red, green and blue bits are in sync vs when they are not in sync?

i have googled, but everything i've found just shows examples without colour in the chart...

(i actually do have a question about reading a bw histogram, but i can't figure out how to explain it properly without a ridiculous amount of words and i haven't the energy just now ;p)

tx lots!
August 31st, 2013
If the red, green and blue bits are *exactly* in sync, then it means the image is black and white -- the brightness of the red component of any pixel is exactly the same as the brightness of the green and blue component of that pixel, so the result is a greyscale image.

For example, here's an image where the saturation has been almost completely dropped. You can see that the histogram is almost all white -- this means that the red, blue and green bits are all the same height. Because there is a slight amount of colour left (too little to easily see), you can see some very slight bits in the histogram where there is colour detail:



However, I think you're asking about images where the red, blue and green histograms have peaks that either line up or don't line up. Simplistically, these can indicate whether the image has a neutral tone or not.

Taking the example image again, here it is (fully-saturated) with a histogram overlaid:



In this case, we can see we have a largish peak just under half-way along the histogram (arrow pointing to it). We can see that a lot of this peak contains all three colours (the white section), some of it contains green and blue (the cyan section), and a bit of it contains just blue (the, err, blue section).

We can also see that we have a smaller red peak to the right of the main peak. Because the red peak is to the right (higher) than the blue peak, that means that most pixels have stronger red components than blue components -- it's a warm image.

If we adjust the white balance on this image, we can make it even warmer:



We now have three very clear and distinct peaks, a blue, green and red one (arrowed). We can see that the red peak is now much much higher than the blue peak, indicating that this image has a very warm balance to it -- which is what we see with our eyes.

If we do the opposite adjustment, we get this:



Here we have dramatically cooled the image down, and now the peaks are separate but reversed -- it's instead the blue peak that is furthest right (highest), with the red peak being at the left. That shows that the image has a predominantly cool balance.

This information can help when trying to colour-balance a photo, especially one with multiple light sources in it. However, it's important to remember that it's really just showing the colour spread in an image. For example, this image has a very strong blue sky component, so it's natural that it will have a very strong blue peak:



While you could attempt to line up the peaks of this image, it does not result in a particularly pleasant appearance:



So by all means use it as a tool to help accurately balance your image, especially if you are using a non-calibrated screen, but don't see it as something that you can simply 'fix' and make the image better. Similarly for sunset shots, usually they will have a higher red peak than a blue peak, because sunlight at sunrise and sunset has a naturally 'warm' tone, that it would be counterproductive to correct.

Questions welcome!
August 31st, 2013
@abirkill thank you thank you thank you! VERY helpful (as always :D)...

i wasn't thinking that there was necessarily anything wrong - just wondering what it all meant... i have a third colour image for today that i haven't posted (two seems to be enough for one day for me ;p), that has the wierdest histogram with different coloured spikes all over... and then i remembered a class i took once where the all the colours got separated into a comb pattern and that wasn't good for some reason... hence the question...

bookmarking this page as it is supremely helpful...

tx tons!
August 31st, 2013
No problem :)

A 'comb' histogram is typically the result of an overprocessed image, particularly one that was edited in 8-bit mode.

I'll stick with black and white, as it's simpler, but the same principle applies in colour. A simple way to get a comb histogram is to start with a relatively flat image:



(I've made this image excessively flat for the purposes of demonstration)

We then load the image into Photoshop in 8-bit mode, and perform a simple levels adjustment:



However, because we're in 8-bit mode, that means that we only had 256 'shades' to play with to start with, and the levels adjustment has stretched the histogram. This adjustment has stretched a starting value of '62' to '0', and a starting value of '221' to '255'. This stretching, combined with the limited initial tonal information, results in 'gaps' -- in the same way that if you multiply every number between 1 and 100 by 2, you'll end up with no odd numbers. For this change, it may mean that (for example) a mid-range value of, '100' might have moved down to '30', and a mid-range value of '101' has moved down to '33'. We now have no tonal data with values of 31 or 32 -- the image is now 'banded', and if we look at the histogram after the levels adjustment, we can see that:



The 'comb effect' is because there are tonal values that should exist in the image, but don't. This is bad for image quality, and can result in banding patterns on the image and other artefacts.

The way to fix this is to process the image in 16-bit mode. This means that, instead of 256 tonal values, there are instead 65,536 tonal values in the initial image, and we can make a strong levels adjustment that won't leave us with significant gaps in our histogram. Here's exactly the same image, processed exactly the same way, except that I imported it into Photoshop in 16-bit mode initially:



You can see that almost all of the 'comb effect' has gone, showing that this image still has a full range of tonal values.

Note that if you do adjustments in Lightroom, then it automatically uses 16-bit mode under the covers, so you don't need to worry about this. Artefacts from this kind of processing typically only start to show visibly after several steps, but a 'comb' histogram is a clear sign that the image has been processed heavily, and should be avoided if possible. Also note that this only really works with images that have more than 8 bits of data to start with -- RAW files contain typically 12-14 bits of data, so processing in 16-bit mode will avoid comb effects. JPEG files contain 8 bits to start with, so processing in 16-bit mode will rarely help much. (This is another good reason to use RAW files if you are going to do significant image processing).

Edit: Fixed the last image.
August 31st, 2013
@abirkill Alexis, henceforth known as the "Histogram Cracker"! Excellent tutorial! :)
August 31st, 2013
Nia
@northy the only time (other than Alexis explanations, isn't he great?) I understood anything about the histogram was from an e-zine/PDF - it's Craft and Vision1 by David Duchemin - it's free. http://craftandvision.com/books/craft-and-vision/
August 31st, 2013
YOU ARE THE GREATEST!!!!!!!!!! @abirkill
August 31st, 2013
Nia
Came back to bookmark @abirkill amazing font of histogram information.
August 31st, 2013
@abirkill you are da bomb! thank you so very much... :D

@sianipops @welcometocarolworld @grizzlysghost Alexis is awesome indeed!!!
August 31st, 2013
@abirkill 256 'shades' of grey...? Hehe...anyone? Sorry, I had to.
August 31st, 2013
Nia
@remirixjones oh Lord, should we start calling him Master Christian?
August 31st, 2013
@sianipops I assume that's a 50 Shades reference...? Never actually read it. Just make jokes about it. :P
August 31st, 2013
Nia
@remirixjones yes, the principal male character. Heard there is a possible movie being made, even my imagination can't figure out how that will turn out.
August 31st, 2013
@northy Thank you for asking! Can't wait until I have time to read this tonight!
August 31st, 2013
@abirkill Thank you so much! This is such a clear explanation and helps me so much.

Thanks @northy for asking the question!
August 31st, 2013
@abirkill Excellent examples Alexis.
August 31st, 2013
@abirkill Brilliant explanation, thanks so much
August 31st, 2013
@abirkill Alexis, simplicity in an explanation is golden - you nailed it! Thanks!
August 31st, 2013
@abirkill - wow! i never paid attention to this thing, but when you explain it, i read and surprisingly understand it and it doesn't make my head ache. thank you for sharing with us your vast knowledge of photography and other stuff. bookmarking this.

August 31st, 2013
@abirkill thanks for explaining this. Never really taken notice of the histogram as I didn't understand it, now I shall be more aware of what is going on. Also going to bookmark this for future reference.
@northy glad you asked this question.
August 31st, 2013
@abirkill this is a fantastic explanation. Thank-you
August 31st, 2013
Thanks everyone, glad I could help out! :)
August 31st, 2013
Thank you so much, Alexis. Very helpfull! :)
August 31st, 2013
@abirkill We need to start a new challenge; Stump Alexis
August 31st, 2013
@abirkill Can I clone you, shrink you and keep you in my camera bag? I promise to feed you and all!! lol I'm bookmarking this also. I swear, Alexis, you seriously should do a book or youtube or something! You explain stuff better than anyone/anything I've come across before!
August 31st, 2013
@abirkill what @ozziehoffy said... :D
August 31st, 2013
I have decided that what my life needs is an indexed compilation of every post written by Alexis Birkhill @abirkhill!!! Can you imagine what a resource THAT would be?!?!? (or what Cassandra said.. but I'd probably forget to feed him.)
@northy @grizzlysghost @sianipops @welcometocarolworld @remirixjones @orangecrush @taffy @frankhymus @jantan @mikegifford @summerfield @salza @rachelwithey @stimuloog @photohoot @ozziehoffy
August 31st, 2013
@m9f9l - i either put them in my favourites or copy the link and e-mail it to myself. he @abirkill explains everything in a way that i don't fall asleep! every time i see a question being posted on here, i check it out for alexis' reply.
August 31st, 2013
@abirkill Hey Alexis, do you have, or have you ever considered writing e-books on camera and processing topics. If you did I sure that there would be a number of customers right here on 365. Craft and Vision has some great e-books and some e-books written by you would be a great addition.
August 31st, 2013
@abirkill Question re the "comb" histogram explanation. I'm new to Photoshop...how do I control 16 vs. 8 bit mode? (Also, why--assuming I have lots of room and RAM--would I want to work in 8 bit?) Thanks.
September 1st, 2013
@abirkill You are such a wealth of information. Thank you for all you do. I really wish I could set up a day to search for your posts and read them all but I don't know if my little brain can take that much info at once. I'll be reading your posts as and when I get time like a book. :-)
September 1st, 2013
@houser934 It will depend on how you get your images into Photoshop.

If you use the Adobe Camera Raw plugin, there is underlined text at the bottom of that window that you can click on, and allows you to set 8-bit or 16-bit, as well as the colourspace you want to work in.

If you import into Photoshop from Lightroom, you can set the external editing preferences in Lightroom to determine the same settings -- see here for more details:
http://help.adobe.com/en_US/lightroom/using/WSA810DC18-9A3B-4f2e-B09C-1C45DD1F8EDC.html

The main disadvantage of editing files in 16-bit mode is, as you guessed, memory and disk space. 16-bit files will take up twice as much memory and twice as much disk space compared to 8-bit files.

Note that certain file formats (most notably JPEG) only support 8-bit data, so when you save a file as a JPEG, you will be saving it in 8-bit mode. Photoshop will automatically do this if you ask it to save a JPEG, but will warn you that you are saving it as a copy, as a (pretty non-obvious) way of warning you that the file format you've chosen cannot store the full tonal variation.

It's OK to save files as JPEGs, of course (not least of all as it's the only widely-used format on the Internet for photography) -- because the file has been edited consistently in 16-bit mode, you will not get a 'comb effect' histogram by converting it to 8-bit mode when it's saved -- this only occurs if editing is done to an already-limited 8-bit file. However, you should also choose to save your file in PSD or TIFF format, both of which will save the full 16-bit data, in case you wish to perform further edits in the future. (You should be doing this anyway, as JPEG is a lossy format).

Let me know if you have any questions :)
August 11th, 2014
@abirkill Thanks for this ... I was wondering if you wrote the 'new faces' script ... I've been on a few times and wanted to add that to my profile for this project I'm working on. Thanks in advance.
Write a Reply
Sign up for a free account or Sign in to post a comment.