Using multiple exposures of a raw photo to get more detail
One of my main photographic interests is trains, and I like to be able
to retrieve a lot of detail - the running gear beneath the body is often
very dark. By using raw photos I can use a "correct" exposure, an overexposure
to provide the dark parts, and a corresponding underexposure to provide the
highlights and (mostly) balance things out. But I think this approach can also
be useful for general views.
My aim is to simplify my preparation - I still have to sort out lens
distortion, and rotation or perspective distortion when the camera is not held
straight, but the process is now a little easier.
The following example pictures are end results, resized to 400 pixels tall.
Each one links to a set of images at 900 pixels tall
showing the camera's own jpeg, various raw exposures, the result of the plugin,
and various corrective measures after that. These are not necessarily the
best way to process each of these pictures, but the process seems to work
reliably on my subjects as well as on general views.
If you are not aware, gimp-2.8 was the old stable series, 2.9 was for
development versions where things did change, and now 2.10 is the new stable
Revision details since I first uploaded this for gimp-2.8 :
- I discovered that my ufraw setup was wrong - I had copied it to a different
machine to work in gimp-2.8 whilst I experimented with gimp-2.9 on the original
machine, and along the way I had managed to pick up an old curve in ufraw,
instead of the default straight line from bottom left to top right. That boosted
some darker tones, and in some cases I used different exposures because of that.
- I only had this working for gimp-2.8. Now it is working in 2.9
and to prove that I've used 2.9 for some of these examples (Alpacas, Banyuls,
- On the original I used G'Mic Tone Mapping
in the mistaken belief it was like the old Advanced Tone Mapping plugin : it is
more like a sharpener. Now I've gone back to the old
Advanced Tone Mapping plugin
except for the Banyuls pics where I forgot (and since doing those I've updated
to a newer version of gimp-2.9) : in current 2.9 this plugin will produce some
messages, but for the moment they are harmless.
- In my latest testing I used a gimp-2.9 version from 2017-08-14 for the Le
Train Jaune pics. (gimp-2.9.6 has now been released, some brief testing on other
pictures shows my plugin still works.)
Originally I used ufraw, but in gimp-2.9 that stopped working. The revised examples
were created using RawTherapee to process the raw exposure, but I was not
comfortable with it (too much to learn). After a pointer from Partha I'm now using
nufraw (with a one-line patch to work with late 2.9 and with 2.10).
- For the final example ('Sir Haydn') I used the 2.10 plugin to prove it was
working, but on the linked page I've shown the camera's own attempt, the effect of
Advanced Tone Mapping, the new 2.10 Shadows-Hilights control, and then my own
Three-Exposures with all the bells and whistles.
- At some point in the gimp-2.10 series I found that the plugin appeared to do
nothing unless I followed it with 'undo/redo'. Around 2.10.6 it did not offer undo
and I had to go to the next action, then undo that, to see the result. Eventually
I realised I was not updating the display. Fixed, and now uploaded.
More details are below the set of pictures.
|Alpacas near Eynsham
||A street in Waidhofen an der Ybbs
|RhB coach A1275 at Poschiavo
||Peldon at the Amberley Museum
|Taliesin at Minfordd
||Le Train Jaune
|Sir Haydn at Towyn, gimp-2.10, page shows alternatives
Summary of the process
This is for raw photos except those from foveon sensors (which create
'x3f' files, used in Sigma cameras) - for those, Kalpanika/x3f appears to be
the only way to use such images on linux or BSD. I've no idea if that can be
used with the gimp.
- Using a suitable tool (for 2.8 I used ufraw, for late 2.9 I initially used
RawTherapee - see item 4 of the revision details above, now I use nufraw with a
patch suggested by Partha), select a
"base" exposure which you think is "correct", an overexposure to get shadow detail
(typically +2EV, but +1EV if not much contrast, or +3EV in a few awkward photos), and
a corresponding underexposure for the highlights. Save each of these as an xcf file.
In gimp-2.10, extract the raw image as 16-bit (nufraw) or perhaps 32-bit with other
tools, then convert to 32-bit floating-point (works faster). If the finished picture
is jpeg it will convert back to 8-bit, if exporting as png you may wish to convert
back to 8-bit (pngs from 32-bit will default to 16-bit, which means bigger files.
- Open the base exposure, then use 'Filters -> Three Exposures' and specify the
files for the shadow and highlight images. The shadow image is added as a second layer,
duplicated, desaturated and inverted to form a mask (i.e. the darker something is in
the shadow layer, the more it wil be used). The highlight image is added above this
and similarly processed, except the mask is not inverted (so whatever is bright in the
highlight layer will be used). Then the layers are merged.
- Often, the result can be hard to view (loss of contrast). I now use the G'MIC plugins
(G'MIC-GTK in v2) and from that I use Local contrast enhancement. Previously I used to
use Gimp's contrast tool.
- At this point I make corrections (lens distortion, rotation, perspective, clipping)
to make the best of a bad job (sigh! ALL modern digital cameras
seem to give barrel distortion on wide-angle lenses, and bridge cameras may give
pincushion distortion at longer focal lengths).
- I now apply the Advanced Tone Mapping
plugin : In gimp-2.9 this produced a number of messages about deprecated
functions, but in 2.10 it seems to work without warnings. This plugin adds an extra
layer, which you will need to merge down. In the previous version of this page I had
wrongly used the G'MIC Tone Mapping, or occasionally Tone Enhancement, filters, but what
those actually do is apply some sharpening. I've now (May 2018) learned that what is
actually happening is that darker parts of the image are lightened to recover detail.
This probably adds to the colour infidelity.
- The picture is probably still slightly lacking contrast. If I'm going to put it
online, I usually want to add some more contrast, at the expense of a little of the
recovered shadow detail. For that I use the Curves tool: click on points at 25% and
75% of the way along the line, pull the 25% point down (parallel to the line) and
the 75% point up. Undo then redo to see the effect, then probably undo again and have
another go - the curve does not usually need to deviate far from the central line.
- Finally, sharpen it. I mostly use the Unsharp Mask. For this, zooming in to
full-size to check the results is essential. In G'MIC there are a lot of other sharpening
filters. Historically I have tended to over-sharpen, I'm now trying to get away from
that, but no promises.
When used with gimp-2.8, I usually get a small rectangle appearing at the top
left of the image after using three-exposures. This is not actually in the iamge,
saving or undo/redo will refresh the display. With gimp-2.9 and gimp-2.10 the display
does not update after running three-exposures: again, either save or undo/redo to force
it to update. I think I've seen a similar issue with Advanced Tone Mapping in 2.9.
- It reduces contrast, so you then have to take steps to restore that.
- Colours will not be accurate - see the pictures of Peldon which is a dark green
diesel locomotive, but tends to become lighter. I now think that uaing Advanced Tone
Mapping probably increases this infidelity.
- The process will not recover all of the shadow detail, and highlights might still
be a bit blown.
- Using significant underexposure for the highlights may produce image noise - see
the sky in the Alpaca pictures (iso400 ±3 stops on a bridge camera). However, photos
using ±3 stops taken on my Olympus, even some at iso400, seem OK.
A lot of the gimp's internals have changed in 2.9, and for 2.10 a function added
two more parameters, so use the correct version of the plugin (last tested with 2.8.22,
2.9.6 and 2.10.0).
The 2.8 plugin is here: 2.8 plugin.
The 2.9 plugin is here: 2.9 plugin.
And the 2.10 plugin is here: 2.10 plugin.
Ken Moffat, 2019-08-06. E&OE