8
\$\begingroup\$

I took a bunch of pictures this weekend and then ran them through Picasa's "I'm feeling lucky" function. As always, I was pretty impressed with the differences. Here's an example:

Unprocessed

Unprocessed picture

After "I'm feeling lucky"

Processed picture

So basically, I'd like to know what "I'm feeling lucky" actually did. The original was more washed out and had lower contrast, but how did Picasa identify what to fix and then how did it fix it?

\$\endgroup\$

1 Answer 1

12
\$\begingroup\$

In their documentation here, Google explains:

Picasa adjusts your photo's color and contrast to produce the ideal photo. You'll see a change only if your photo isn't already color balanced.

That last is the clue: all it's doing is what's known in other software as "auto levels". This is a tool which appears to work like magic in its strong ability to bring out colors and contrast, but the algorithm is actually very simple: For each color channel — red, green, and blue — the values are stretched so that the whole range is covered. It's conceivable that some future version of Picasa might put even more behind "Lucky", but based on the clue in the description and the example you show, I'm pretty confidant that this is all there is to it.

Here's what a similar adjustment looks like, channel by channel, in the Curves tool in Gimp:

Curves Adjustment Tool in the Midst of an Auto Levels Operation:

red channel green channel blue channel

Nothing fancy at all, really. If you don't know how to read this, it's basically like this: all of the values in the given channel on the horizontal axis will be mapped to the value on the vertical axis. In these, everything to the left of the little circle at the bottom of the diagonal line is clipped to 0, and everything to the right of the circle at the top is clipped to 255, with the part in the middle stretched linearly over that range.

You can see that Gimp's auto level button has somewhat aggressively decided to clip some of the end of each histogram. Different software will make that choice differently, so you'll get slightly different results from program to program.

Here's the histogram of the red channel before and after applying auto levels:

Before:

before

After:

after

You can see that before the adjustment, the histogram is in the middle, but afterwards is the same rough shape stretched to both ends. The solid bars at each end are the clipped 0 and 255 values — there's a lot of those since as I mentioned the clipping applied by this tool is a little aggressive.

And, there's another interesting artifact here which isn't really related to your question but shows the peril of working with 8 bit images. The curve isn't continuous, and since we're taking something like 100 values (the bunched-up values in the original) and spreading them over 255 possibilities, there are holes. In extreme cases, this may show up as posterization in your final image. But fortunately, 8 bits is actually quite a bit to work with, and, the colors will be transformed differently in other channels, disguising the effect. But I've always been a little surprised that the curves tool doesn't apply an "anti-aliasing" function to compensate for this.

\$\endgroup\$
1
  • \$\begingroup\$ "For each color channel — red, green, and blue — the values are stretched so that the whole range is covered." - nice explanation, never thought of it that way. \$\endgroup\$
    – dpollitt
    Commented Nov 6, 2012 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.