Tuesday, December 22, 2009

Holiday spirit for the Scrooge in us all

The holiday season is upon us so this post combines image editing comments with links to my favorite Christmas music.  Overall I've got a low tolerance for canned Christmas cheer so today's selections skew toward the offbeat and cynical.

First musical selection: "The Twelve Days After Christmas"

The image at top is a 1904 drawing in pastel and gouache by Everett Shinn, called "Fourteenth Street at Christmas Time".  This is what we'll be discussing today.  Usually the Library of Congress hosts unedited files of its scans.  I can tell someone has fiddled with this, though.  the histogram gives it away.

See those vertical lines across the graph?  That's a dead giveaway the image has been digitally edited.  The lines are evenly spaced, too, so I know what that person did was a straightforward levels adjustment.  This is now it appeared when I downloaded the image and cropped out the border.  It's a shame, really.  Because the histogram wasn't asjusted correctly.  See the gap at the right end of the graph where there's no data at all?  The white point is too far to the right, which gives the image a muddied appearance.

Normally the histogram would be the final edit anybody makes to an image.  It's a point of no return; subsequent editing can't recover the data that gets changed this way.  I played around with this one though, and didn't do anything else to the image.  You'll see how this brings a little more life into it.

And to go with that, here's "Mrs. Claus Wants Some Lovin'"

The difference between this and the earlier version is most noticeable at the shop window and in the snow at the lower right corner.  The downside is that we've lost more data in the meantime.  Here's the new histogram; each of the vertical bars represents a brightness level between 0 and 255 where the image contains no data.

It's sad to encounter a good image that has already been edited in ways that make it impossible to get optimal results from later edits.  This is a good demonstration of why it's best practice to maintain archival copies of digital images without any histogram alteration. Although I'm not against histogram adjustments, I do upload pre-histogram versions of edited files for recordkeeping purposes whenever possible.  That way, if anyone wants to do additional work they don't have to choose between quality loss or completely starting over.

To go with this we have the most somber of today's selections: Simon and Garfunkel's "The Seven O' Clock News/Silent Night"

Just to see what else could happen, I also worked on the histogram with a couple of other tools.  Curves and shadow/highlight allow for more sophisticated alteration than the levels tool.  There are many possible ways to apply them, and I actually don't know what the artist's original looked like or what his intention was.  So these are speculative changes.  Yet it can be a useful exercise to work with different tools and see what one can do with them.  First, the curves tool.
In spite of the somber tone of this scene, I do like the difference.  So here's Shirley Temple singing "I Want A Hippopotamus for Christmas" while we look over the histogram for this edit.

The jagged appearance is a giveaway that this has been edited after a histogram change.  I enhanced contrast toward the darker part of this image, which accounts for the change in its overall curvature.

One other thing we could try is the shadow/highlight tool.  It performs sophisticated enhancements on the brightest and darkest ends of the histogram.

If you're interested in studying the artist's technique this version might be useful, but it brings out distracting information.

The emotional impact of this image seems to be in the contrast between the bright shop window and the poor peddler.  A mass of shoppers cluster near the established stores while he struggles with his small cart of merchandise ankle deep in icy sludge.  If the store window isn't bright enough it doesn't set off his misery.  More than anything else, that hunch was what prompted me to look at the histogram in the first place.  And the straightforward levels adjustment of my first edit seems to confirm that opinion.  The curves and shadow/highlight tool edits were attempts to refine the idea.  I didn't want either the snow or the cart to look too cheerful, but I wanted to keep that bright window looming above his head.  Does it suggest a halo?  Maybe he endures this to support a family.

Of course these are speculations that I wouldn't articulate on Wikipedia.  Yet they're elements I do consider when working with an image.  There's also an argument to be made that fine art shouldn't be restored at all.  Yet this image was already edited before it was put online, and if my opinion is worth anything that edit wasn't done very carefully.

So since we're looking at histograms today, here's the histogram for the fourth version.  I happen to like The Bobs (they're an underrated a capella group), so linking "Christmas in L.A." along with this.

Overall I prefer the third edit for this one, but am not quite sure which way to go.  Seeking opinions and input.  Your voice is welcome.

Monday, December 14, 2009

Making light of troubles

While Garrondo and I were discussing the Photoshop curves tool last night he asked me to blog this restoration as an example.  It depicts a pair of Balinese dancers and dates from 1929.  The photograph also has a lot of other distracting elements, so let's fast forward to the completed restoration and then concentrate on a few points.  Here's wishing the actual editing went so quickly; it actually took a day and a half.

The most difficult part of this restoration was not the obvious marks and streaks.  It was the tall flower on the right dancer's headdress.  The dust specks weren't so hard to remove; the problem was what to do with all that streaky low contrast bands which intersected it.  Compare it to another flower at far left: the unrestored versions appear so different that side by side, they hardly look like they both come from the same photograph.

Regardless of what caused the streaking (I've got several guesses), the first question was whether to correct for it.  So work began by getting rid of the spots specks, while leaving the streaks unaltered.  Sat back for a view of that version and decided the streaks really needed to go; they served no visible function other than distraction from the primary subjects.

The next phase of editing didn't try to create a totally even background.  I didn't want to alter much adjacent to the dancers themselves.  One of the few areas where background absolutely had to be patched near a costume element, though, was that darn flower.  Used the clone stamp at a low hardness setting to get a natural effect.  Afterward several brightness adjustment masks reduced the starkness of the differences between portions of the image.  Also enhanced contrast at the rose, which ultimately meant re-cloning the background in that area.

The final result on that flower might be a smidgeon too contrasty.  Yet considering what there was to work with, it was a pleasure to see it come this far.

Another aspect of this restoration was really gratifying at the end, although it's subtle enough that it's scarcely the first thing to catch anyone's eye.  In the original photograph the face on the dancer at right is slightly overexposed.

To see the difference a curves adjustment makes, here's a view of her as she looked after all the edits except for the curves adjustment had been completed.  There's a blandness and flatness about her; it's hard to catch her expression.

Now have a look at how the curves tool brings out the midtones.  Her face is still youthful but less like putty; more personality shows.  And the intricate contours of her headdress and shoulder band become more noticeable.

Restoration can be tedious work.  An image such as this one has so many obvious flaws that one runs the risk, out of exhaustion, of shortchanging the final adjustments.  I wish I knew the name of the somber young dancer in this photograph.  Those eyes look like she saw a lot of life at an early age.

Sunday, December 13, 2009

Showing off one's curves

December has been a very busy month so far.  After publishing an editorial in the Wikipedia Signpost, several people approached me with an interest in undertaking digital restorations.  Some of them had never tried it before.  So this post is dedicated to one of those adventuresome and talented people.  Garrondo expressed an interest in science and in Spanish history.  So after his first effort, which went quite well, he asked for advice about choosing a second project.  The Jay I. Kislak collection of the Library of Congress rare book division was a good place to go: it includes a 1790 publication of early Spanish colonial archaeology by Antonio León y Gama.  The scanned book is 145 pages of text about Aztec science and art with one glorious fold-out illustration, reproduced above.  And thanks to excellent digitization practicesthe LoC the illustration is also available in a 37 MB TIFF version.

Garrondo liked the selection--who can blame him?  But it's a very ambitious project for a beginner.  The scan suffers from bleed-through text and the original has smudges with a distracting crease through the center.  It was also made on laid paper, which carries its own distinct pattern that makes restoration bothersome.

He came back today with an impressive first effort.

One has to view these things at full resolution to see how good his work is: Garrondo took care of the dirt and creases and bleed-through text while preserving the laid paper pattern.  The result is worthy of featured picture recognition and highly encyclopedic.  So bless him--he took my criticisms very well.

It looked like he had adjusted the histogram.  He provided a pre-histogram TIFF file for me to play with, which became a demonstration of the difference between Photoshop's auto levels feature and its curves tool.
At left is the auto levels version; at right is a manual curves adjustment.  Notice how the paper seems less dirty and the contrast is better on the snake's scales and the sun's face.  Both adjustments deal with the image's histogram, which assigns a brightness value of 0 to 255 to every pixel on an image.

Physical documents lose contrast as they age: nearly every newly produced image will have values across the entire 0 to 255 range, but older documents often have no data at the extreme ends of the histogram range.  In this instance the extreme points were 7 and 236, with minimal data toward both ends.

Auto levels chops the histogram toward the extreme points of its range--but may lose a little bit on both sides--and does a straightforward average of the remaining data.  So I suspected the auto levels had lost information on paper texture.  The simplest way to address that would be to redo levels manually, but there was more to be accomplished here.  Curves allows a nonlinear change in the histogram.  Or to express it without jargon, a curves adjustment lets the editor enhance contrast in the darker end of the range where those scales are and enhance contrast again in the midrange for the sun's face and the figures on the dial while reducing contrast at the bright end to make the paper appear cleaner.  For a closer look, here's the curves adjusted version on its own.

The result is brighter, clearer, more vivid.  Garrondo can get even better results if he puts more work into that irritating laid paper background to minimize smudge marks.  Notice how good the lower right corner looks: a similar quality on the other three corners will improve the final result.  This isn't just a matter of background detail.  Software isn't intelligent; Photoshop can't tell the difference between a historic archaeological report and a dirty smudge.  It's the human editor's task to prepare an image with informed choices so that the data is as good as possible.  Takes a lot of patience, but when it's done right the final edit feels like magic.  Like a window back in time.

Garrondo agreed to put more work into the smudge removal.  It will take a little practice for him to get used to the curves tool, but the result is worth the effort of learning.