One of the first things many postprocessing tutorials teach is to adjust the levels in a raster image editor, so the histogram uses the whole possible range. In my RAW editor (Darktable), there wasn't a levels setting, so if the histogram was too far in the middle, I used the exposure slider to stretch it to the left and right. I thought that, similar to levels, it just stretches the range in which there is information recorded, discarding the extreme parts. (Of course, I didn't stretch all pictures completely to both ends, but for simplicity's sake, let's say that we are talking about a motif for which it is the right thing to do).
Now, Darktable was upgraded to version 1.0, and got some new modules. One of them is a levels module. I assumed that using it to stretch the histogram will do the same as using the exposure module, but was curious to see if this is what really happens. I tried it, and noticed that it doesn't work this way.
This is what a picture can look like using both methods. The upper part was made with levels - the white part is darker, but has more details. The lower part was made with exposure. I have the feeling that it also affected the saturation of the greens, but I might be wrong.
These are the histograms. The first one is of the levels setting, the second one is of the exposure setting.
What is the real difference between the two settings? How do they work, to produce the different results, and why?