Step 2: Theory- Layered Image Editing
How do we do it?
HDR is where layered image editing programs such as GIMP or Photoshop are very useful. Using a technique called layer masks, we stack the photos with different exposures, rather like a stack of acetate sheets, and make the parts we don't want transparent so the best parts show through the stack. Photoshop/GIMP are doubly useful for this because we can make them do the hard work of actually making the layer masks.
When stacking layers in an image editing program, it is necessary to specify how transparent you want each part of the image to be. Rather than have to do this by hand, image editing software lets you do this by providing a second greyscale image that specifies how transparent each part should be. White parts of the layer mask make the corresponding part of that layer opaque, so they show up on the finished image, and black parts make that part transparent so the lower layers show up. A couple of clever tricks in the software let you generate the layer mask from the original in a few clicks, rather than laboriously paint the entire layer mask by hand.