High resolution film transparency digitalization using macro lens and stitching

From PanoTools.org Wiki
Revision as of 22:10, 31 January 2012 by Torger (Talk | contribs)

Jump to: navigation, search



Say you have a bunch of medium format film negatives or transparencies you want to digitize. What are your options?

Flatbed scanners are poor - always out of focus, the best consumer scanners only yield around 2300 ppi real resolution (even if scanning at 6400 or more!) and dynamic range is often poor (=crushed noisy shadows). Dedicated tabletop film scanners are much better but for medium format they are hard to come by these days and are quite expensive. They usually scan at 3000 - 3200 ppi and unlike flatbed scanners they deliver the resolution, and usually have better dynamic range. The best is still drum scanning but these are becoming even harder to come by and of course extremely expensive to buy new.

So what about using a macro lens, a digital 35mm camera and a light table? Equipment you may already own. Yes - it is possible and if done correctly you get very good results, much better than flatbeds and on par or even exceeding dedicated tabletop film scanners.

This method is also applicable to 35mm film transparencies, but since 35mm tabletop film scanners are relatively cheap and often good quality that can be a more practical alternative. Still I do use macro lens digitalization for 35mm, to get that little extra in resolution and dynamic range (HDR) and cover 100% of the film frame (film scanners usually crop the borders some).

I recommend a 16+ megapixel APS-C camera for 35mm transparencies and a 20+ megapixel full-frame camera for medium format. At 1:1 macro distance (near limit for most macro lenses) the lens covers the same area as the sensor, that is 24x36mm for a full frame sensor and about 15x24mm for APS-C, meaning that you will cover the film area with four frames, which then is stitched in Hugin.

If you use a full-frame sensor on 35mm film there is no need to stitch (film size = sensor size), but one typically wants higher sample resolution on 35mm film and then stitching with an APS-C camera may be a better solution.

Why mess around with stitching at all? To get professional level resolution so you can make large high quality prints! This tutorial is not about getting "ok" results (then just use a flatbed, or shoot the whole frame at once without stitching), this is about getting very high quality, and really extract the detail that is on fine-grained film.


You will need

  • A fairly high resolution digital camera
  • A good quality macro lens suited for repro photography
    • low distortion, sharp corners, flat focal plane
  • A light table
  • Copy stand or corresponding arrangement

I have myself used a Canon 5D mark 2 (21 megapixel) as full-frame and a Canon 7D (18 megapixel) as APS-C. I have used the Sigma AF 150mm f/2.8 EX DG HSM APO Macro OS lens.

The 5Dmk2 with this lens produces about 3600 ppi of resolution (out of 3900 in pixel density) at f/8 over the full area, while the 7D produces about 5100 ppi out of 5900 at f/5.6. This have been tested with a resolution test slide of the same type used for testing film scanner resolution. In other words, the 5D resolution exceeds a typical medium format film scanner (3200 ppi) and 7D a 35mm film scanner (4000 ppi).

Concerning copy stand, I have actually used a regular tripod and a 90 degree bracket built from arca swiss-based pano head, and attached a focus rail to that so the camera is perpendicular towards the ground, and just place the light table under. I also got use from my leveling head from the pano head setup. Focus rail allows me to finetune center focus distance, and the leveling head to fine-tune perpendicularity to get sharpness in the corners.

Concerning light tables there are cheaper thin portable ones, and more expensive larger ones. The color rendition is probably good enough or maybe even the same on the cheaper ones, but the more expensive have probably better light uniformity. I use a thin portable type and think it produces good enough results, i e the small light variance it has is not detectable when passed through real images.

Shooting tips

For full-frame f/8 is the aperture to use. f/5.6 may yield a slighter sharper image due to less diffraction, but the depth of field becomes impossible. For the smaller area the APS-C frame covers f/5.6 is feasible. You need a lens that perform well at these apertures, which macro lenses usually do.

At full-frame f/8 the depth of field is about 0.6mm. This is small, and one of the major challenges doing this is to keep the film within the DOF.

If you have mounted slides, film flatness is usually not a problem if they are well-mounted. You also get some air between light table glass and film which is necessary to avoid newton rings.

If you have unmounted slides, then precisely cut out a frame in cardboard, tape the slide to one side (not all sides, almost impossible to make perfect, the slide film will curl, at least if 6x6 medium format). This cardboard frame is to give some space to the light table, and avoid light leaks on the side of the film. All light must come from the back of the film or else you will get contrast problems.

Curl is a problem with larger slides (medium format), but one can fortunately make use of the fact that only a smaller part of the film is shot at a time. You can thus make an overlay from a smooth flat hard material with a 30x45 cutout or so which you lay on top that press down the film, and you move the light opening to fit where you currently shoot. Put a lens shade or similar on top of the cutout to weigh it down and to avoid stray light from the sides. Instead of a cutout you can have two plastic cards or similar put on top of the film leaving a gap for the camera.

If you are going to digitize many unmounted slides, make a quick and effective reusable frame mount, since one otherwise may end up spending most time mounting the film.

When film is mounted as flat as possible, focusing is the next challenge. You absolutely need live view with zoom for this. In my suggested setup one focuses on the center of the frame using the focus rail, lock it down and the check the corners with zoomed in live view and adjust with the levelling head if necessary.

You will notice that at f/2.8, which is what you'll probably focus in, the DOF is about 0.1mm and at then it is impossible to have all parts of the frame in sharpest focus. If your lens have lots of field curvature then it may be hopeless, but even with a good lens the marigins are too small at f/2.8. However by careful adjusting you can get all parts into close-to-sharpest-focus which is good enough when you take the shot at f/8 (when DOF increases to 0.6mm). Focusing correctly is a key part of getting good result. A bad focusing job and your digitalization will be worse than a cheap flatbed scanner would do.

For APS-C and shooting 35mm when the film area covered is smaller and film curl usually less of a problem you may attempt f/5.6. Actually you'd probably want to, since the small pixel cameras start to loose significant resolution due to diffraction if used at f/8.

Then there is the dust problem. A transparency shot this way will never be 100% dust free. You will have to accept some dust and include dust retouching into the equation. It is not all bad though, when you later stitch blue featureless skies you'll often find yourself using dust spots as anchors for control points :-).

Use a dust blower, a soft brush and possibly burn candles close to the light table to cause an upward air flow to keep away as much dust as possible.

Watch out for vibrations. Mirror up (typically shooting in live view mode) and cable release is mandatory. An interesting experiment is to zoom in live view maximally and tap the camera or stomp the floor, and you'll see how easy it is to introduce vibrations, which will take away that resolution edge.

Shoot RAW in manual mode and adjust exposure as close to clipping as possible, but do not clip! Rather use some safety margin than clip.


Convert the RAW files to a neutral 16 bit prophoto tiff in a high quality RAW converter. To get that final edge on resolution you need a first class demosaicing algorithm. RawTherapee does this well, but there are also other alternatives.

Correct the following properties:

  • chromatic abberation
  • barrel/pincushion distortion
  • (vignetting)
  • color reproduction (apply icc profile, see color management)
  • hot/dead pixels

RawTherapee has an auto-mode for chromatic abberation correction, but since film slides themselves may contain abberations from the lenses used when it was shot, it is better to make to use statically tuned CA correction to avoid interference. Make test shots of a resolution slide for example, put in all four corners and find it tuning parameters. Good quality digitalization requires very good CA correction of the lens, so we have high image quality over the whole lens area. Even lenses with low CA usually improves with correction.

Should the lens have much quality issues in the corners one can use large overlaps and crop masks in Hugin to avoid including those in the stitch, but with large overlaps one needs more shots which takes more time.

Barrel/pincushion correction is for normal panorama projects better to let Hugin do. However, my experience for this special macro application is that the Hugin optimizer does not behave that well as it does for normal panoramas, here often overdoing lens corrections. Therefore I recommend correcting this in pre-processing as precise as possible. Shoot something straight near the edges of the lens and adjust correction parameters the line becomes straight.

The lens I have used here has extremely low vignetting, so vignetting correction for that was unnecessary. Hugin can also correct for vignetting (not a part of layout optimization, so it won't disturb), so it is a matter of taste were you correct it. Corrected in pre- processing you save some time in stitching, then you can skip the exposure-tab alltogether.

Don't do any further tunings like sharpening and contrast etc, I think it is better to leave that until after stitching when you can open up the stitched tiff again in your favourite RAW converter or photo edit software.

Color management

Light tables usually have cold cathode lamps which has good but not perfect color rendering index (CRI), I consider it good enough for professional use though (drum scanners do have halogen lamps that have CRI 100 which is required for 100% perfect results). The light from the light table is similar to daylight spectrum (will look blueish in an indoor setting), but still without calibration the colors in your shots will not be correct. Either you play around with white balance etc until you get a pleasing look, but to get a good consistent result you really need to calibrate your system.

For this you need to get an IT-8 transparency and get the associated text file which contains information of the color properties of that transparency.

You can use Argyll to make an icc profile:

  • Get it-8 target reference text file, often available on the manufacturer's web site.
  • Shoot the it-8 target on the light table, good exposure without clipping
  • Develop from raw, if rawtherapee use "save reference image for profiling" (16 bit tiff gamma 1.0 no input or output profile)
  • Run argyll
    • scanin -v2 -G1 -a -dipn file.tif it8.cht it8ref.txt
    • colprof -v2 -D"Canon 5Dmk2 Gepe lightbox" -qu -am -u file

This generates a matrix type icc profile, LUT is more risky and rarely better for cameras. This profile is then used as input profile when converting RAWs of transparencies shot on the light table and the camera used when the it-8 target was shot. Should you change camera model or light table lamps (lamps can vary a bit) you need to make a new profile.

Hugin stitching tips

Theoretically, stitching part would be straightforward. And if you have a very high precision setup it can be. In practice though, you probably don't have. I don't. It is more important to strive to get every frame as sharp as possible over the whole frame, which may require slight adjustments after film has been moved. Some parameters Hugin stitcher may need to deal with:

  • different roll on the images after moving the film on the light table
  • very slight yaw/pitch errors due to non-perfect perpendicularity
  • film curl variations after moving
  • very slight changes in Z due to focus readjustment

You should first try to only correct for X, Y, and roll, and hopefully you get a good result, but probably not always.

Here is the stitching workflow I use:

  • Create new project
  • Open the 16 bit tiff images (usually four)
  • Don't use the field of view from EXIF, instead pre-set to 1 degree.
  • Make control points to connect all images
    • I'm a bit old-school and always do them manually, about four per image is enough, just try to spread them out widely
    • Well-placed manual control points often perform better than auto-generated
  • Make horizontal (and possibly also vertical) guides on all images
    • You should have included film edge on all your frames and that is what you use as guide, the top-down film edges are generally more reliable as guides than the sides
  • Now the exciting part - the optimizer tab, we are going to do it all custom, Hugin often delivers best results if we optimize the parts that requiure largest corrections first and then add on parameters that need less correction for further optimization
    • First correct X and Y for all but one
    • Then add roll to all and optimize again
      • Theoretically this would yield perfect result already here, and if you have sub 2 pixel max error you probably should be satisfied.
    • If not satisfied, then add Z for all but one and yaw and pitch for all, and optimize again
    • Then open up GL preview, goto move/drag and select drag mode "mosaic", and then drag the image into the center of the view, close and optimize again
      • Typically the optimizer has put the image far from center, and moving it back into the middle again and reoptimizing can give better result.
    • You can try to add lens view as a final parameter but that usually does not improve things.
  • Open up GL preview
    • Choose rectilinear projection
    • Mosaic-drag so the center is in the center of the image
    • Fit/autocrop the view
  • Skip the exposure tab if input was corrected for vignetting (or the lens had very low vignetting)
  • Stitch to 16 bit tiff output, for further processing in your favourite raw converter or photo editor

About field of view: at macro distance a macro lens's field of view is usually considerably smaller than its focal length indicates. Hugin uses field of view as a guide for yaw/pitch corrections and while these often are reqiured to compensate for imperfections in the setup, the Hugin optimizer in this special case often makes too large corrections if the field of view is not set to a small value. Even if the lens has 10 degrees of FOV, try set it as low as to 1 degree. Note that this is not normal Hugin operation, but this macro lens application seems to fall outside normal optimization space.

About vertical/horizontal guides: it is often hard to set up perfect horizontal/vertical guides, they usually conflict a little, so with these involved you often don't get down to subpixel fit. If you get a lot of trouble you can try having only horizontal (or vertical) guides, using the most reliable film edges. Beware that film edges can be slightly bent, due to micro-curling or imperfections in the film. Skipping the guides alltogether usually lead to slightly distorted results (non-rectangular frame).

Sometimes I get good result with only X/Y/roll correction, and sometimes I do the whole optimization workflow. A typical fitting result I get on my stiching is 0.5 pixel mean error and 1.1 pixel max, on a bit more troublesome cases I can get 1.4 pixel mean and 5.1 max. Even in such cases enblend will handle the situation excellently for all normal type of images. Sometimes one gets a very good fit earlier then expected in the optimization workflow, and then one should not optimize more, just drag the result into the center fit, crop and stitch.

Be sure to check that the image becomes rectangular. If yaw and pitch is involved it sometimes happens that the shape becomes distorted even if the fit is good. Try add both vertical and horizontal guides if this happens, or avoid using yaw/pitch optimization.

If optimization seems hopeless, it may be the case that the film was too curled or you had some other problem during shooting leading to distorted input.

The exact setup and shooting technique may vary a bit from mine, which means that there may be an optimization order that works better for your system. Feel free to experiment. The key concept here is applying a very narrow FOV and correct for yaw and pitch although one theoretically should not need to.


The look of film transparencies is usually just the way you want them freshly digitized, just adjust exposure to fit the highlights just below clipping. That's normally all it takes when color calibration has been used. Negatives need to be reversed to positives of course.

The big thing is however dust and scratch retouching, which is kind of mandatory, they digitized images are never 100% dust free. As a Linux user it is unfortunately hard to find a photo editor that has a good healing brush and supports 16 bit tiff. If you are going to use Gimp it is only 8 bit so you have to live with that. In the Mac/Windows world there are many alternatives, but most of them are rather expensive if you just need the healing brush. PhotoLine is one of the more affordable ones. If one wants to, one can make the dust healing on a separate layer to avoid modifying the original.


Some film transparencies are very contrasty and have very dense shadows. If you want sufficent dynamic range on these to get noise-free shadows in your prints you will need to do HDR. Use the camera's built in bracketing function, shoot in live view and use a mount to be sure that the camera is not disturbed during and between the bracketed shots. Two shots 4-6 stops spaced is usually good.

At the time of writing (Hugin version 2011.4) I have not got Hugin's builtin HDR function to work well (hugin_hdrmerge has some issues) so I have used external HDR software in these cases.

Personal tools