04 Lesson 2: Lightening, Darkening, Sharpening

In lesson 1, we learned how to take a photo and crop and resize it.
But what if the image isn't quite right? What if it's too light,
or too dark? What if it isn't quite sharp? Can we fix that?

For this lesson, I'm going to use a photo I took of an Audubon's
Warbler in my backyard (already cropped):

http://shallowsky.com/images/gimpcourse/lesson2/warbler-orig.jpg

It's not a very good picture. It was an overcast day, and the
camera exposed for the bright sky and not for the bird. I didn't
compensate for that, so it's too dark. In addition, it's not very
sharp. But I didn't have a photo of one of these warblers before,
so I wanted to try to save it.

The first thing to do was to try to fix the exposure. If an image is
too dark, or two light, there may not be enough information there to
make a good photo. But there's more information there than you can
see with your eyes, so it's always worth a try! You may get something.

Simple photo editors generally give you sliders for "brightness" and
"contrast". GIMP has those, but it also offers two other ways of
changing these parameters. Let's compare them.

A quick digression: all of these brightness/contrast tools will
be in the Colors menu. In GIMP 2, you'll find Colors in the image
window menu, under Layers->Colors. In GIMP 1.2, it's also in the
image window menu (remember, right-click to see the menus) under
Image->Colors. Since we'll be choosing several different options
under the Colors menu, let's take advantage of a helpful feature
in Gimp's menus: "tear-offs". Call up the Colors menu (the first
item will be something like "Color Balance") and notice that at
the top of that menu, there's a dotted line: --------
Click on that dotted line, and the Colors menu becomes a separate
window on your desktop, which you can move to any convenient place.
Now you don't have to go through all those layers of menus for each of
the following options.

Now, from the Colors menu, call up Brightness-Contrast... to get
the basic brightness/contrast sliders. Play with these sliders
and get a feel for what they do. Maybe they're all you need.
But when you're done experimenting, Cancel out of that (or Undo
whatever you did) because we're going to try the other techniques too.

The next brightness adjustment method is the Curves tool: Colors->Curves...
This is my personal favorite. It shows you the same histogram as
the Levels tool did, but instead of the two sets of sliders, your
adjustment is a diagonal line. Grab the line anywhere with the mouse,
and drag it up-right or down-left, and watch how the image changes.

You can make fairly complicated adjustments with the Curves tool.
For example, if the dark parts of your photo are too dark but the
light parts are all right, after you've dragged the line out to
one side or the other, click on it again somewhere else, and drag
it in a different direction. You can make curves shaped like s, w,
or anything you want, and the shape of your curve controls the
brightness of different parts of your image. I won't try to describe
the mathematical colorspace transformations going on here: just grab
the line and pull it around and see what it does! Keep fiddling
until your image looks better.

The final method is the Levels tool: Colors->Levels...
The Levels tool is the most complicated, but it's very powerful.

The Levels dialog has two sets of controls: Input Levels, and Output
Levels. Input Levels shows a histogram representing the current
brightness of the image. If it's pretty even, then the histogram
should be filled in fairly evenly. If it's way over- or
under-exposed, then the histogram probably shows a spike over to
the left or the right.

Both Input and Output have sliders which you can play with to make
the image brighter or darker, more or less contrasty. Don't neglect
the middle slider (also called "gamma value", if you've heard that
term before) under Input Levels -- you can fine-tune the contrast
of the image with it. You can also use the "eyedropper" buttons under
the Input Levels slider to pick points in your image which should be
all black or all white: click on the eyedropper button, then click at
the right place in the image.

One final thing you may notice about the Levels dialog is the Auto
button. This is theoretically comparable to the "Auto Levels" in
some other photo editing programs; but in practice, I find that
it almost never chooses the right values. (This may say more
about which photos I try it on than it does about the Auto Levels
button, however.) It's always worth a try; you have the Reset
and Cancel buttons there if you don't like the effect.

I find Levels much more complicated to use than Curves, but I
know people who swear by Levels, because they find the histogram
so useful. Try both, and use whichever you like best.

You may have noticed that both the Levels tool and the Curves tool
have a Channel menu at the top of the dialog. This defaults to Value
(which you can think of as meaning total brightness), but you can also
choose Red, Green, Blue, or Alpha (Alpha means transparency). You can
use these tools to make fairly subtle shifts in the color of an image.
That's way beyond the scope of this lesson (and I'm not very good at
it anyway!) but if you have an image with an unwanted color cast,
Levels and Curves are among the many color tools which might help.

One final note on brightness correction: in the Colors menu under the
Auto submenu (not related to Auto Levels) are several filters which
are supposed to correct for brightness problems: in particular,
Equalize and Normalize. I haven't generally found them to help my
images, but give them a try -- maybe they'll work for you. If they
don't, just Undo and try something else.

Here's my warbler, brightened up by fiddling with the Curves tool
(only one point on the curve):

http://shallowsky.com/images/gimpcourse/lesson2/warbler-brighter.jpg

SHARPENING

Okay, you have your lighte image. But it's still fuzzy!

GIMP has two ways of sharpening: they're both in the Filters->Enhance
menu (you can use the tear-off to make this menu conveniently visible
while you're doing this).

The first is Sharpen... It has a preview area, and a slider where
you can choose how much to sharpen the image. Too much sharpening
makes an image speckly; too TOO much can "posterize" it almost beyond
recognition. Go ahead, play with it and see.

The second is Unsharp Mask. This is a confusing name: you don't
want to make the image unsharp, you want to make it sharper! (The
name comes from the way the algorithm is implemented: it makes a
blurry copy of the image, then uses that in various transformations
to make the original image sharper.) Some image editing programs
call this "Sharpen More" or something like that, to avoid this
confusion, but "Unsharp Mask" is really what this procedure is called.

Unsharp Mask has three parameters: radius, amount, and threshold.
Radius generally affects how local the sharpening will be; amount
controls how strongly the effect will be applied; and threshold
controls how different nearby pixels have to be before any sharpening
will take place.

Unsharp Mask very often gives better results than Sharpen. But
unfortunately, since it has three parameters and no preview, it
can take a while of experimenting and Undo to find just the right
settings. It can be worth it, though, if you have a photo you really
want to keep and there's no chance of taking another shot with better
focus.

Here's my warbler, sharpened with 4.5, .25, and 0:
http://shallowsky.com/images/gimpcourse/lesson2/warbler-sharper.jpg

and with more than that, illustrating how graining over-sharpened
images can become:
http://shallowsky.com/images/gimpcourse/lesson2/warbler-toosharp.jpg

There you go -- you have a brighter, darker, or sharper image!

Homework: show an image you've modified in any of these ways.

Next Lesson: Introduction to Layers, and the Text Tool.
Let's make a Valentine's Day card!