Focus Stacking, First Stumbling Steps

Edit: 2009/01/30, evening.  After much searching I relocated an incredible site I had encountered before.  Charles Krebs’ work is really, really, incredible.  I was motivated to explore focus stacking after seeing image 29 in gallery 8, which I believe was produced with stacking.  Dig around his page, it is really awesome.

— Original —

I ran into the technique of focus stacking not long ago, and have been itching to try it since. I haven’t found good subjects, but I took a first stab this morning. The results of some of workers with this technique are absolutely mind-blowing. For some of my favorite work on the net, see My example is of a small natural turquoise from a local mine. I used very poor stabilization, and I believe that has resulted in the artifacts at the far edge of the stacked frame. Nevertheless, this is very promising. Now if I can just find some interesting subjects.

My shooting setup for this, by the way, is crapulent to high orders. I use a bucket on a trashcan in the sun as a sort of lightbox, and a precarious tripod to shoot. The tripod was the source of my instability issues, but the trashcan certainly didn’t help. The bucket is not quite as good as the Lambertian integrating sphere I’d like, but it is rather more affordable.

Color Management – Reprise

I noticed that what I included in my post Introducing… does not look the same on my monitor as it does on my friends’ monitors. While I expected some of that, I observed that the effects of interest were not at all visible, particularly the posterization. To solve that, here’s a quick comparison, done by taking a photograph of my monitor. In the left photo I have color management on, but the mode is set to “display”. The right photo is set to “proof” mode, with the output device emulating the Costco glossy prints. See Dry Creek Photo for a variety of lab profiles.

The Color of Software

Philosophy of Use

This article is rather long.  Please scan ahead to the pictures to see where we are going, then come back and slog through the details.

The basic tasks I’ve needed to perform on digital photos since my first digital camera (a Canon G3, may it rest in peace) are:

  • orientation flipping
  • cropping
  • contrast adjustment
  • white balance correction or adjustment
  • straightening
  • communication to friends, family, work peers (by email or Web host)
  • printing, for albums, sharing, my lab notebook, or display

For several years I resisted photo annotation tools, which let you add text tags or captions to pictures, because the annotations were stored in proprietary non-portable databases. Image metadata formats, particularly IPTC, can carry captions, tags, and useful context details. Now that IPTC is widely supported, the picture files can carry this metadata without external databases. It is a compelling feature.

I used to organize my pictures in date folders, typically the date of transfer from the camera. All the pictures I shot on Christmas vacation ’07-’08 might get uploaded on January 3, 2008. The pictures would be stored in a directory with a name like 20080103, a format I love because it lists chronologically when sorted alphabetically. If I needed to edit pictures I would process them in GIMP, which has supported cropping, flipping, contrast, and straightening reasonably well for many years. Modified versions of the picture would be saved with some indecipherable name, like dc021_m2_sm.jpg, which might stand for “2nd modification, resized smaller (sm) for upload to web”. As a process, this was the pits.

In the last year my needs have grown, due largely to lessons from shooting with a digital SLR.

Shooting Raw

I’ll forego jokes about naked photographers. I started looking at more advanced editing software because some prints I ordered had dreadful color issues. I had the idea that the color problems might have been caused by some contrast stretching I performed in Picasa, or even that the image exceeded the dynamic range of the camera. Dynamic range issues in a camera can be treated three ways.

  • At the shoot, if saturation is the issue, then underexposing a little can improve the shot. If the scene is very high dynamic range, then the dark areas may be clipped on the low-exposure side. Even if they’re not clipped, the signal-to-noise ratio in the darker areas may result in noisy regions of the photo. Noise removal software can sometimes help, but I regularly shoot conditions where there is clear loss.
  • Shooting camera raw preserves the full dynamic range of the camera’s sensor, which might be 12 bits per channel instead of the 8 bits per channel available in a JPEG file. Postprocessing the raw file could potentially allow level compression to provide a better JPEG than the camera’s processing.
  • Bracketing exposure and then combining in software can effectively enhance the dynamic range substantially. Some packages allow combining bracketed shots to get enhanced dynamic range. Normally I can’t shoot with brackets since my subjects are frenetic, so bracketed-shot combining is more of theoretical interest than practical.

This implies a few requirements for photo-editing software. First, it must be able to work well with raw images. In particular, I must be able to apply “levels” functions or “curves” functions to images containing the full raw dynamic range. In other words, those functions must work on 16 bit per channel images. Secondly, raw import of my camera’s format must be supported. Thirdly, combining bracketed images should be supported—though this is not a strong requirement.

Postprocessing raw files is tricky. You really don’t need an entire lossless file at 16 bits per channel for cropping, rotating, touchups, or most editing. However, for adjusting levels, contrast, or colors a full 16 bits per channel is a good thing—especially if you have a picture with really dark shadows and really bright highlights. Your tools must also be able to read your camera’s raw file format—for my ancient camera this is easy, but people with newer cameras sometimes discover that their files don’t import.

It turns out that my print issues had nothing to do with poor editing or limited dynamic range of the picture, and everything to do with color management. More on that later.


Consider that you might solve all your problems with photo management by acquiring software. Here are three approaches that might seem reasonable.


For advanced editing use GIMP, which is very capable editing software. For downloading from the camera, managing photo collections and albums, uploading to the web or printers, and emailing Picasa is really very good. You might even consider just using GIMP for editing. Newer operating systems provide sorting and searching of EXIF data.


For well under $100 you could get Adobe’s Photoshop Elements or Corel’s Paint Shop Pro. These include picture management systems, sophisticated editing capabilities, and some limited uploading or emailing capabilities.


For $250 to $300 you could buy Adobe’s Photoshop Lightroom, which is an extremely sophisticated software package. I suspect it has the same uploading and emailing capabilities as Elements. Of course, Lightroom costs nearly as much as a new Nikon 35 mm lens.

Really Expensive

For something over $650 you can get what would seem to be the acme of photo editing tools, Adobe Photoshop CS4. I didn’t even bother demoing this, so I can’t comment on its photo management or distribution capabilities.

I compared some of the preceding applications for my specific interests. What will work for you depends a great deal on what you want to do. My baseline before getting interested in raw image processing was Picasa and GIMP. The rest of this document looks at some of the capabilities I consider important for some of the packages I just listed. To be fair, I’ve spent enough on camera equipment this year that $200 software package looks really profligate—so my emphasis is on free or cheap options.

The simple truth is that I love Picasa for almost everything. Here’s why:


To my stark staring amazement, PSE7 actually pops up little bubbles containing advertisements while you’re trying to work. I don’t know what is required to turn this “feature” off, but to get this in purchased software is intrusive, irritating, and offensive. Be prepared for an astonishing level of rage if you use this software.


For email I use Google’s gmail, and Picasa’s email button works flawlessly with gmail. PSE7, PSP, and Picasa all support email through MAPI clients like Microsoft Outlook or Exchange. I have earned a burning hatred of Outlook and Exchange through many years of use. For a web-side gmail user, Picasa is the only choice.

Uploading to Print Services

For uploading to print services, Picasa is very simple. I select the photos I want to upload, and use one of the myriad pre-configured services, like CVS, Walgreens, Winkflash, Snapfish, Ritz, Kodak, Shutterfly, or one of about a half dozen others. This is distinctly different from PSE7, which offers only Shutterfly, and PSP which offers only CVS.


Captioning photos in all three applications results in text being stored in the “Description” component of the IPTC block. In Picasa and PSE7 captioning is trivial—just click the “caption” line below the picture and type. Captions in Picasa and PSE7 appear below the picture in the file sorter mode. In PSP captioning requires clicking the image, and then scrolling down in the context pane on the right. You cannot tell which files have been captioned except by clicking each one (or possibly with a search).

In short, PSE7 and Picasa offer similar interfaces to captioning. PSP supports both tagging and captioning, but with substantially less convenience.


Tagging in all three is accessed with a click. In Picasa tagging is accessed with a click on the little tag icon, which opens a dialog where you type the tags in. Auto-completion offers suggestions as you type, based on previously entered tags, which makes this painless. PSE7 tagging is richer, but I think harder to use. Tags are created and associated with a group, for example “people, friends” or “people, family”. This is tedious, and the categorization of the tags is not stored in the file. PSP offers simple text entry of tags, without auto-completion, categories, or even commonly-used tag lists. Tagging many files in PSP would be agony, but the interface is present adding or updating a few tags.

Historically I haven’t used tagging, but the ability to at least identify the subjects in the photo is compelling.

Raw Import

Import of camera raw files, in my case Nikon NEF from a D40, is supported in all three packages. There is no on-import control in Picasa, but it reads and imports the files without trouble.

Basic edits are well supported in Picasa, including satisfactory white balance, contrast enhancement, straightening, and cropping. Naturally PSE7 and PSP are extremely capable editing tools—far more so than Picasa. In a shootout of the file sorting and sharing capabilities Picasa is, without question, leagues ahead of PSE7 and PSP. Why consider a non-free package like PSE7 or PSP at all, if Picasa is so capable?

Remember that my journey started with color problems in a print. The final, and perhaps most important requirement, is that I be able to soft-proof pictures before I have them printed. Soft proofing is the process of approximating the appearance of the printed product on the computer screen.

Raw handling

The above picture is a composite of JPEGs produced by all three programs and the camera, all using program defaults on import. None of them are dreadful, but they are all very different. I chose this shot for demonstration, despite its awful composition, because it has a huge dynamic range. The black of the dog (Angus) next to the white of the fence in the sun has proven to be a very, very difficult shot to get well. The white of the fence is “blown out” or totally saturated.

If I spend some time and try to tune each import to get effects I want—such as details of Angus and relatively vibrant colors—I get the following.

The differences are still noticeable, but not huge. I like the PSE7 version slightly more (and it was easier to get), but the intensity of the colors is a little too high. The saturation should probably be somewhere between the PSP and PSE7 versions. Probably the take-away point is that you can get virtually anything you want the PSP, but there will be a few more steps than in PSE7 and a little experience required.


Picasa imports my raw files without trouble. There is no active control over the import process. I assume that Picasa applies corrections for color and white balance, and any sharpening automatically. I also assume that the working bit depth for Picasa is 8 bit per channel, since modifications to a raw file are saved as JPEG images. While this makes Picasa capable of using raw images, it offers essentially no advantages over shooting JPEG.

In general the images Picasa imports are washed and look distinctly desaturated compared to the JPEGs produced by my camera.

Photoshop Elements 7

PSE7 can import my camera’s raw files. Indeed, I really like the PSE7 raw import tool. The tool, like most, provides adjustments for sharpness, brightness, white balance, and saturation. In addition, it includes an adjustment for the enigmatically named “vibrance”. Vibrance is a really wonderful control; it can give images from my Nikon D40 the kind of rich colors you get from a Nikon D300, without the improbable skin tones that come from simply cranking up the saturation.

However, PSE7 has almost no capability with 16 bit per channel images. I can understand why rotations, touch-ups, and so on are not defined for 16 bit per channel images, but I can see no excuse for leaving out color and light manipulation tools. Levels, curves, hue, saturation, and value adjustments must be defined for 16 bit per channel operations, or I get very little editing capability.

Paint Shop Pro

PSP imports raw images without trouble, though there is no special raw import tool like PSE7 provides. However, almost all operations are defined for 16 bit per channel images, including crop, rotate, sharpening and so on. All the effects available in the PSE7 raw import, except Vibrance, are available in PSP, except that they are not located in a single palette convenient palette. On the other hand, PSP can perform the levels, curves, and color correction operations on the full 16 bit per channel image, making it particularly useful for manipulating raw files.

Color Management

To see why color management can be so important, please see my article Introducing….

The picture shows screen captures I took using PSP with color management off, and with color management on, in “proof mode” below. The bottom picture represents quite accurately all the problems I observed in the prints I received.

Digital images represent colors with numbers, which must undergo transformation into control signals for devices like monitors and printers. Image files most commonly represent colors the sRGB or aRGB (Adobe) color spaces. A printer, or online developer might have a totally different color space defined. The printer or developer uses their devices profile, along with some kind of optimization protocol (called an “intent”) to transform your image into control signals for the device. For excellent detail on color management I recommend Color Management by Bruce Fraser, Chris Murphy, and Fred Bunting, a book I found to be deeply enlightening.

Practical color management starts in the operating system. Mac OS has provided OS-integrated color management since at least version 10.4 (Tiger), and possibly before. I don’t know if Mac OS natively supports on-screen proofing, or if that is application specific, as it is on Windows. Microsoft provides color management in Vista and XP, though at least the Vista version can be flaky, especially before SP1. The operating system level generally provides application of monitor, printer, and sometimes scanner calibration ICC profiles. The profiles are often generic, and therefore of dubious accuracy, but if you have calibration tools to get accurate monitor profiles, you have a chance of at least reasonably approximating the output. However, your application must support proofing mode, or at least this is true on Windows.

Color management is not a panacea—not all devices can represent all colors. Color management helps create pictures that look relatively good, or which have tolerable errors, but it does not mean WYSIWYG.


Picasa offers no color management tools. You can still gain more accurate rendering by using a good monitor profile, but it won’t reveal issues in your print process.

Photoshop Elements

PSE7 offers no color management, either. Note though, that Adobe in general offers the best color management tools. In Adobe Lightroom and CSx you get tools like “show out-of-gamut pixels” which highlights areas in your image which will be altered during printing. I understand proofing modes are also supported.

Paint Shop Pro

Surprisingly, perhaps, PSP offers color management for proofing. In addition to “basic color management” which merely accounts for your display, there are proof modes that combine your monitor’s calibration with a printer profile to provide a reasonable representation of what you’ll see on paper.

PSP is not perfect in this respect. As far as I can see there is no way to transform your image to carry the information for the printer—in other words PSP helps you see problems, but offers little that is specially designed to help solve them. There is no “out-of-gamut” tool to provide a quick snapshot of problem areas.


As of version 2.4, GIMP includes color management, with proofing modes and optionally out-of-gamut display. I tried this and it did not produce the same effects I got with PSP—that is, the picture looked fine in proof mode, and the only out-of-gamut areas were the subject’s pupils. In short, it did not work correctly. If it was my error then this may be the only affordable option to provide color management with near-Lightroom capability. Either way, prepare to invest significant time in mastering color management with GIMP.

Image Combining

Enhancing dynamic range by combining bracketed images is not something I expect to use substantially. However, there are cases where such a feature would be useful. Image combining can require alignment first, so some utility for image registration is probably required too. Picasa, unsurprisingly, does not offer an image combining capability. PSP offers one, including an alignment module. PSE7 does not appear to provide image combining, though I would not be surprised if Lightroom does.


My experience is that for sharing, basic editing, ordering prints, uploading, captioning, and tagging the free Picasa is unquestionably the best. For sophisticated editing Paint Shop Pro is a huge winner, with support for on-screen proofing, 16 bit per channel editing, bracketing combining, vector layers, and all of Photoshop Element’s editing capabilities except vibrance.

Maintaining monitor calibration is important, as is finding reasonable profiles for your printer or lab. However, the most important parts of color management are probably in getting the shot and in choosing the lab. If I weren’t so cheap I’d probably try Lightroom, which I believe has superior color management and presumably has more 16 bit per channel capability. However, I doubt its sharing utilities have much over Picasa.


Digital photography is a joy. Shortly before Christmas I ordered prints from Winkflash, and was appalled at their appearance. It was clear that I had a Color Management issue. I thought color management was analogous to the descriptions of wine. “Apricot with a hint of sunshine”—monitors can’t really be that bad, not if millions are sold every year.

I have been reborn.

An Experiment

But first the history. I got a bad print. Should I have been shooting raw to capture the full dynamic range? Did I goof with some easy white balance or exposure fix in Picasa? Did Winkflash misprint the picture?

Did I shoot the picture wrong?

Well, there is plenty to criticize, especially the bottom of the framing and the shallow depth of field. However, the exposure is decent, and the color is at least plausible.

Should I have been shooting raw?

That picture can never be reshot. Since the picture looks nice on the screen it is clear that truncated dynamic range was not the problem in this print. I had no experience working with raw (NEF, in the case of my Nikon); this experience has encouraged me to learn the value. Soon I will post my lessons of raw, and comments on the tools.

Did I goof with postprocessing?

No. The following picture shows the original and the printed version. I don’t remember the exact fixes I applied, except the obvious cropping. Any contrast stretching or color tuning are nearly invisible.

Did Winkflash misprint the picture?

In summary, yes. But so did Costco and Snapfish. The following section discusses the differences between the developers I compared.

Digital Photo Developers

In the above picture (O) is the original, (S) is Snapfish, (C) is Costco, and (M) is Mpix. I dislike the green and blue posterization and banding around her head from the Snapfish and Costco prints. It looks like she was cut out with scissors and glued on. The Mpix print is a little too desaturated—though I find the effect almost unnoticeable. The Mpix image has no obvious flaws, like the dithering or posterization. The differences between the original and the Mpix photo may appear because my scanner is not calibrated.

The Costco and Snapfish prints are both awful, but notice how different they are too. The Snapfish picture is much bluer, and has coarser dithering. Her skin looks too red in the Costco prints, and too blotchy in the Snapfish prints.

I am confident the relative difference between the three prints can be compared; the comparison to the original is possibly questionable. I scanned the three prints simultaneously so any scanner auto-adjustment would be consistent.