Pixels in the Dark

A Super Sleuthing Photo Rescue Quick Trick

November 7, 2000

Use the Gamma Correction in PSP6 or the Histogram Adjustment in PSP7
to uncover clues in darkness of a digital photograph.

[ PSP index ] [ Composite Index ] [ PSP Links ] [ 3D Bits n Pieces ] [ Tutorial CD ]

Can this Photo be rescued?

To work this tutorial, please click on the image on the left to get the bigger version to work on in PSP. Or use this link.

Once the image opens in the browser, right click and Save the image as Castle1.jpg somewhere on your hard drive. Then open it in PSP.

This example, a digital photograph, was generously supplied by a person who asked to remain anonymous.

As you can see it's way way too dark!

Our project today is to lighten the image if possible and check the for details which could be lurking in the darkness.

Within this image taken in a supposedly haunted castle, we are looking for evidence that someone still lives there, be it human or otherwise. Somewhere in this picture could be the clue we need to substantiate our claim that the building is, in fact, occupied.

So what we need to do here, is get enough out of the photo to look around, but not necessarily enough to actually make a perfect print from it.

With that in mind, how can we go about looking deep into the darkest pixels?

First, let's take a look at the Histogram for the photo to see if there is ANYTHING besides jet black in the darkest parts of the image!

In Paint Shop Pro, and I am using version 7 today, but this first part will work in 6, press the "h" key on the keyboard to toggle the Histogram on.

What is a Histogram?

A Histogram shows the amounts of red, green, blue, greyscale, hue, saturation, and/or lightness values in an image.

The horizontal axis shows the lightness values of the image from black to white (0 to 255). The vertical axis shows the amount of pixels at each value. Spikes in the Histogram show where there are lots of pixels at a particular lightness level. A low flat line or curve shows that there are few pixels at that lightness level. In a dark image such as this, the majority of the pixels are clustered on the left side. If the photo was really light and washed out, the pixels would be grouped at the right side.

For now, lets check the boxes on the histogram for Red, Green and Blue and Greyscale. As you can see, all the pixels are clustered on far left, but there are colors hiding in the dark over there!! That's what we need to know!

There is more to the Histogram but let's not go there today!

So what can we do? By now you have decided, like me, that the image needs to be lightened somehow. There are a bunch of ways to lighten this image and retrieve the detail in the dark areas. But we will concentrate on one each for PSP6 and PSP7.

A very easy way, especially for Paint Shop Pro 6 users, is to fiddle with the Gamma Correction.

(PSP 7 users, this works for you too, but I will describe a second method, I think is better in a bit)

Gamma of an image is a measure of it's contrast and brightness. Adjusting the Gamma adjusts the brightness and contrast in unison.

Go to Colors on the Menu Bar and Adjust and pick Gamma Correction... from the flyout boxes.

On the dialog box, make sure the Link box is checked and move one of the sliders to the right. Fiddle with the values until you can see the detail you need. I used a value of 2.5. Click OK.

It looks a whole lot better right now, doesn't it?

But notice all the pixelization in the previously dark areas.

Usually after doing a gamma correction, the image is a bit flat. Often it helps to increase the contrast in an image to perk it up again.

Go to Colors and Adjust again and pick Brightness Contrast from the flyout box. Drag the contrast slider up to about 10. And press OK!

That would be a good stopping point for this image. Now we could look for clues of inhabitation.

Well I don't see any candy wrappers, or anything.

Wait, could that be a shadow beyond the white doorway? LOL



Paint Shop Pro 7: JASC has added a new feature to the Colors, Histogram functions accessed from the Menu Bar. Besides the stretch and equalize functions in PSP6, we now have Histogram Adjustment in PSP7.

First, UNDO the changes to Castle1.jpg by pressing CTRL + Z on the keyboard twice to undo the brightness/contrast and the gamma correction. Go to Colors on the Menu Bar in PSP7 and Histogram functions, Histogram Adjustment from the flyout boxes. On this fancy new dialog box, we can make some great things happen.

In the image below, notice the clusters of light grey mountains in the white box, those indicate the luminosity of the pixels in the image. Note that they are clustered on the far right like on our histogram display.

Notice the diagonal line in the box in the middle. Under that are 3 up pointing arrows. The black on on the left represents the dark pixels, or the low values. The middle grey arrow represents the midtones, (Gamma), and the white arrow on the right represents the highlights or high values.

By fiddling with these arrow positions, which change the curve of the diagonal line, we can pull the detail out of the image and improve the images contrast in one step.

Next to the word Edit, select Luminosity from the drop down box.

Start by moving the white arrow to the left till the reading under it is about 225.

Then move the middle arrow to left until the value in the Gamma box reads about 2.14.

Notice in the preview how the image lightens but is a bit flat.

On the right side of the dialog box, find the Midtones: compress and slide the slider down to about -10.

Press the OK button.

Again we can see the detail in the image, but this time we didn't blow out all the red pixels.

I still don't see any evidence of habitation in this image, do you?

But, its pretty amazing how much we can restore in a too dark image with the right tool, isn't it?

That's it for today's super sleuthing pixels in the dark hunt! Which ever method you prefer using to improve the image is up to you. There are more ways to achieve similar results in PSP but we will leave those for another day.

[ PSP index ] [ Composite Index ] [ PSP Links ] [ 3D Bits n Pieces ] [ Tutorial CD ]

All Tutorials and Tips including images and text
Copyright 2003 3D Workshop, Inc.

Further distribution prohibited without express permission.
For information e-mail is in image below