Making HDR (“High Dynamic Range”) images in Photoshop — the way I do it
Sunday, August 1st, 2010First, some links:
HDR according to Wikipedia
Here’s some of my attempts at HDR
OK, then. I’ve been asked to share some of my thoughts and tips on using Photoshop to create HDR images. So I will.
Why HDR?
All cameras are limited in the range of values that they can capture in one exposure. Ansel Adams made his bones by getting a really nice spread of tones (from black to white) in his prints using the ‘Zone’ system. The main idea was to avoid having large areas of your image that go completely black or white. The goal, expressed in a simplistic way, was to have information everywhere you looked in the picture — to avoid flattened black or white areas.
The hard part in achieving this is that when you pick an exposure level for a photo, your camera will probably end up getting one end of the black-to-white range wrong. Set the exposure correctly for the shadowy areas, and the lighter areas will be over-exposed; set the exposure to capture the details of the brighter areas and the shadows end up looking all blobbed up and black. It’s hard, but Ansel Adams got really good at getting a really nice spread of grays without blobby blacks and blown-out whites.
So did Eadweard Muybridge, but he cheated. Muybridge wouldn’t worry about getting the exposure on the sky right when he shot landscapes, because he didn’t need to: he had a drawer filled with beautiful negatives of nice sky-shots filled with detailed clouds, and he just double-exposed his prints with the sky shots he had laying around. That fixed his blown-out sky problem. This trick made him a lot of money long before he achieved lasting (and, in my book, deserved) fame by perfecting stop-motion photography.
In his defense, Muybridge would’ve used the modern HDR techniques outlined below if he could, but it was really hard to do the double-exposure trick with negatives that weren’t all sky. If I recall correctly, he tried it, and it didn’t work out.
While it is probably possible to get nearly-Ansel Adams-quality exposures out of modern digital cameras, few of us have the patience (or, let’s admit it, the skill) to manage it. So we cheat.
(Relatively) Easy HDR with digital cameras
Every digital camera I’ve owned (going back, now, to 1999) has done an acceptable job of calculating a pretty good exposure automatically, but all of them (from a Fuji FinePix 1300 to a Nikon D50) usually pick an exposure that leaves muddy shadows or blown out highlights — sometimes both in the same picture. Time (read: Improved technology) has improved things, but even today few digital pictures end up ‘perfectly’ exposed.
Happily, though, as quickly as a modern camera can calculate a decent exposure, it can calculate a related under- and over-exposure. This is called ‘bracketing’, and your camera probably offers it as an option.
What your camera will do if you turn this on is take more than the ‘best’ calculated exposure; it’ll throw in others just above or below the calculated ‘best’. For this discussion, we’ll assume you’ve set up your camera to include an under-exposed pic and an over-exposed one. (There are other ways to use bracketing, but you’re on your own for those, champ.)
My guess is that the camera makers included this feature, originally, so that you could compare the three images and pick the one that best suited your intention when you were shooting. What we’re talking about with HDR, though, is taking the best parts of each of the three and combining them into one image (I’ll try to be careful here and not call the results of HDR ‘pictures’).
Side note: I own a D100 that I picked up used (and cheap) as a back-up camera, and it doesn’t seem to bracket as ‘widely’ as I can make the D50 bracket; I think Nikon, when they made the D100, was still thinking that bracketing was for taking three different, but still ‘OK’, pictures. My D100 pics don’t seem to HDR as nicely as my D50 ones do. YMMV
Techniques
So: at this point you should have three pictures that are as near to identically framed as you could manage, but that are spread out in exposure (from ‘ouch, way too bright’ to ‘ugh, muddy and dark’ with a pretty normal looking one in between). Photoshop (the only image editing software I’m going to reference, ’cause it really is good and you should probably be able to lay your hands on it somehow) has a menu item located at File->Automate called ‘Merge to HDR…’ You could go there and then select the three pictures you have and then go along for the ride. Try it. That’s where I got started, but I ended up unhappy with the results; I didn’t feel that Photoshop was making the same decisions I would have, and I wanted more control.
If Photoshop’s ‘Merge to HDR…’ makes you happy, use it. It’ll save you all the work I’m going to outline in the rest of this post (it’ll even save you the trouble of reading it).
Back yet? Let’s try another technique.
First, though, let’s review our goals. We, typically, want to take the middle picture (which should be pretty good, but probably has some blown-out highlights and some muddy shadows) and add the nice bits from the other two photos to it. And we don’t want the results to look horribly fake. Photoshop has some tools that will help us.
The main one is Layers, which will let us stack our three picture on top of each other in one image. That’ll be the starting point. I get there by selecting the three pictures in Adobe Bridge and then choosing Tools->Photoshop->Load Files into Photoshop Layers… Skipping Bridge, you can open all three picture in Photoshop and paste two of them on top of the third. Either way, you’ll end up seeing only the top one on your screen, but if you open Photoshop’s ‘Layers’ Window (accessible in the ‘Windows’ menu) you’ll see a Layer for each picture.
Since we’re going to be seeing parts of all three layers in the finished image, it’s important that they all line up with each other. There is a chance that you held your camera so still that the pictures all line up perfectly, but mine never do. I select all three layers in the Layer window and then go to Photoshop’s Edit menu and choose ‘Auto-Align Layers…’ In the resulting dialog, I choose the ‘Auto’ projection option and hit OK.
If that works, your image will be lined up much more nicely than I can ever seem to manage when I try to adjust the alignment by hand.
Staying in the Layers window, you can re-arrange the layers so that the ‘middle’ picture is at the bottom. The idea here is to leave the ‘too dark’ and the ‘wow, that’s over-exposed’ layers above the ‘meh’ middle picture, but to delete the bad parts of them so the good parts of the ‘meh’ layer show through.
That leaves us needing to delete the ‘bad’ parts of the light and dark versions of the image. I do this using Photoshop’s Select->Color Range… option. What this option does is automatically select all the pixels in the current Layer that match whatever is set as the Foreground Color, but with a controllable amount of ‘fuzziness’.
Let’s review the steps we’re going to take in English before I lay out the step-by-step Photoshop routine; understanding the process in English will help you keep track of where you are, and to figure out what went wrong when you misstep:
The starting point for all this pixel deleting is a three-layered image with the middle exposure at the bottom (and all of the Layers Auto-aligned). If you aren’t there right now, go ahead and catch back up. Additionally, these steps are based on having the lightest (over-exposed) Layer on top, so go ahead and drag it to the top (if it isn’t already there). (It doesn’t really matter to the outcome which Layer is on top, but I’m only going to describe it in one order, sorry.)
The steps:
In the Layers Window, make the middle Layer invisible and select the top layer.
In the Tools palate, make sure that the Foreground color is set to pure black.
Use the menu item Select->Color Range… to bring up its dialog window.
Select Localized Color Clusters (or not, but I’ve enjoyed the results when I do).
Adjust the Fuzziness to Max (200). (Or less, but that’s for when you get a sense for how Fuzziness works.)
Hit ‘OK’. That will return you to the Layer with a bunch of selection-indicating lines buzzing at you. You can’t really tell by how it looks, but all of the darkest areas (the interesting ones in this Layer)) are now selected. We need to:
Use the menu item Select->Inverse to get everything but the darkest areas.
Hit the Delete key. Voilà!
A side note: If you overlooked the ‘hide the middle Layer’ step, the deleting will reveal the too-dark Layer that’s underneath; don’t panic. Just go ahead and hide the middle Layer now.
Before we move on to ‘fixing’ the dark Layer, let’s pause and play with what you’ve done. First, hide the selection-indicating lines (turn ‘Extras’ off in the View menu, or just hit Command-H). That’ll make it easier to evaluate what happened. In the Layers Window, show can alternately hide and show the over-exposed Layer to get a before-and-after comparison. If the results look more-or-less OK, we’ll move on. If you want to re-do the deletion with different settings, undo (Command-Z) the deletion, Deselect (Command-D), and try the Select->Color Range…/invert selection/delete steps again.
OK? Back to steps.
In the Layers Window, make the middle Layer visible, the top Layer invisible, and select the middle layer.
In the Tools palate, make sure that the Foreground color is set to pure black.
Make the previous selection go away by hitting Command-D (or choosing Select->Deselect).
Use the menu item Select->Color Range… to bring up its dialog window.
Select Localized Color Clusters (or not, but I’ve enjoyed the results when I do).
Adjust the Fuzziness to Max (200). (Or less, but that’s for when you get a sense for how Fuzziness works.)
Hit ‘OK’. That will return you to the Layer with a bunch of selection-indicating lines buzzing at you. You can’t really tell by how it looks, but all of the lightest areas are now selected. We need to:
Use the menu item Select->Inverse to get everything but the lightest areas.
Hit the Delete key. Yes, that was mostly copy-and-paste from the top (over-exposed) Layer’s instructions, but the differences are important. I often do the light-Layer steps on the dark Layer (and/or vice-versa) by accident and have to undo them. No worries, we haven’t saved anything yet. (Funny side-note: I just typed them backwards and had to re-do the typing.)
Go ahead and make all three Layers visible again. The rote stuff is done.
While the image is still in three Layers, you can adjust the Levels (or Curves), contrast, sharpness and even the Transparency of each Layer individually to get the image looking the way you want. After that, you can use the menu that pops up from the Layers Window to flatten the image. Then you can make your final, global, changes.
There is a pretty good chance that your Layers got skewed a little in the alignment step, so you’ll probably have to crop the image a little to tidy it up.
You’re basically done. Congratulations. Me? I do one more step: I copy the HDR and paste it on top of the original middle exposure, crop and flatten that, and use ‘Save As…’ to make the final image. That’s just an easy way to preserve (one third of) the EXIF information along with the HDR.
Enjoy.




