Leveling Up (Focus Stacking)…

Leveling up, in case you don’t know, is gamer-speak for learning new skills (usually your character has gained new skills and increases in level, e.g. Level 5 character).  I started a project yesterday that had me leveling up like crazy, so much so that my brain started to hurt (figuratively – actually, I just got rather brain tired).

I’m currently in that space where you can’t really sleep because your brain can’t stop working things out (I’ve had less than 5 hours of sleep), you forget to eat until your stomach practically slaps you in the face and then you inhale your food because you are so hungry.  This post is more for me than it is for you, a place where I can put down my thoughts, take some notes, and literally empty out my brain of some of the info it’s trying to hang on to while I attempt to learn more.

final2_LR1000It may not look like much, but this image is the product of 25 images, but I’m getting ahead of myself, let me back up…

I’m a big fan of macro photography, I love my 180mm macro lens.  But I’ve always wondered how other photographers get those awesome images of bugs and other small things.  For some reason, I always thought that they had more skill or better equipment than I do, which they probably do on both counts.  But, it never really occurred to me that they were Focus Stacking.  Because I didn’t now what focus stacking was, to be honest.

Focus Stacking is taking several images, while changing your focal point, then stacking them together with a post-processing program to give you one in-focus image.  It is kind of like panoramas only these images stack on top of one another rather than beside each other.


So I’m looking at this 5x macro lens* and drooling at the possibilities and I start being nudged toward this focus stacking thing, along with focus rails, and focus stacking software.  Suddenly my brain is spinning… what the heck is all of this?!

I wind up down this path of way too many tabs on my browser, a tired brain, and an excitement to learn more.  I found this awesome tutorial for Focus Stacking (using Open Source software) from my favorite GIMP tutorial writer, Pat David.  I watched this video on how to take focus stacked macro photos (image stacking) and was pleased that I didn’t need a focusing rail.  And I also watched this video on a different piece of software I’m considering called Zerene Stacking.

1st Attempt


Set-up: Canon T2i, 180mm Macro lens, ring flash, remote

My first attempt I took some photos of a Canadian coin… I don’t think I took enough photos, or rather, the photos didn’t overlap enough for the algorithm to know what I wanted.  The align program only output one file (it should have output many), so I just used the original files… and realized that I needed more light as well.


9 images stacked

2nd Attempt

I re-shot the coin with more images and more light (a reflector).  This time the align program gave me more output images, but they were crazy and wonky (I’m thinking I need more overlap between images).


So again I just used the original files to stack.  It had a strange pink cast that I cleaned up in GIMP.

I was getting better, but I wanted that align program to work (there is a definite shift in the image over the lettering), so I changed my subject.

3rd Attempt

I chose one of my dog’s toys because it had a lot of texture and ultimately I want lots of detail in my macro when I’m out in the field.  This time around the align program worked out well.  But I still needed to refine my image taking skills and have a bit more overlap between images, and possibly more images, because there were several blurry sections in the final image.


7 images stacked

4th Attempt

Finally, I was starting to get the hang of things.  I took 38 images, I ended up throwing out the first 6 and the last 6 because they didn’t have enough sharp areas to deal with.  I did quite a bit of clean up in GIMP, bringing in 8 images to mask and bring back some detail in places… but it is a good start I think.


L to R: 25 images stacked using Enfuse, cleaned up in GIMP


For Reference (L to R): Image #12, Final cleaned up image


Software I used for this project, all of it is free and Open Source (but may be limited to Linux):

  • Rapid Photo Downloader (to get the images from my camera’s memory card to my computer)
  • UFRaw-batch (command-line program to convert large numbers of RAW images to ppm)  UFRaw provides a batch processing command – just open the first image (in the GUI), apply your settings, then save those with the option “Create ID File” set to “only”. Then you can use ufraw-batch to apply the settings from this.ufraw file to your images.  ufraw-batch *
  • ppm2tiff (for some reason GIMP doesn’t like the tif files created by UFRaw – so I convert the ppm files to tif with another program)
    ppm2tiff [options] [input.ppm] output.tif
    for x in {001..008}; do ppm2tiff input_$x.ppm output_$x.tif; done
  • Hugin (alignment software)   align_image_stack -v -m -a OUT *
  • Enfuse (to stack all the aligned files together)
    enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --output=final.tif OUT*.tif
    more options…
    (blurs a bit)
  • GIMP (post-processing software) I used this to clean up the backgrounds, and in image attempt 4, I added several layers and masks to clean up some detail.

Again, go check out Pat David’s tutorial, it covers Hugin and Enfuse and what to do to stack a bunch of images, I learned a ton from that tutorial.

Whew!  I’m starting to feel a bit better.  I think I’m going to go scarf down some food and then start processing some images of flowers I took this morning, wish me luck. 😀

Until next time…

* a 1x macro lens is considered ‘life-size’, so a 5x macro lens is magnified 5 times more.

4 thoughts on “Leveling Up (Focus Stacking)…

  1. Zerene Stacker is superbly easy and combines everything above into one program and workflow.. But it is not free software 😦

    It is however well worth the investment if you are serious about macro.

Kind thoughts and comments are always welcome...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.