An Introduction to Focus Stacking

An Introduction to Focus Stacking

focus-stacking-photo A.jpg

A guest post by Chen Wei Li from

After weeks of preparation, I finally set out to the Singapore Botanical Gardens to nail the shot above using the technique called focus stacking.

Focus stacking is a technique used to increase depth of field in a shot with post production. This works especially well for shots using long lens and in this case, a macro lens. Let’s go back to some photography 101 here. There are three factors that will affect depth of field or ‘bokeh’:

1. Focal length. Essentially the longer your lens, the more shallow your depth of field is.

2. Distance to subject. The nearer you are to your subject, the shallower your depth of field is and it very much applies to macro lens.

3. Aperture settings. The more you open up the aperture of your lens, the resulting image has a shallower depth of field. This, however, does not matter as much where the photo above is concerned.

I am happy to say that the experiment above has been a great success!

A little more background story.

It all began on 15 May 2010, when i was making my usual walk around the Singapore Botanical Gardens to take photos. I spotted this interesting looking cactus and ran a few shots at it. When i came home and uploaded the photos, below what was i got:

focus-stacking-Photo B.jpg

I’m pretty pleased with the composition and stuff. But i hated the shallow depth of field and the resulting ‘bokeh’. Some might argue it helps to lead viewers eye to the core but i believe the cactus lines have done enough a job in that department (Go find out more on leading lines for composition if you are not sure what i am talking about). I wanted other parts of the photoraph to be focused as well.

I told myself surely i had to come back again to work on the same shot… But how?

Thankfully, i remembered a friend of mine who once mentioned the use of focus stacking for food photography.

So exactly how does focus stacking work you may ask. Well, focus stacking simply means taking multiple photos of the same subject, each with a different focused spot. This is followed by the use post-processing software like Adobe Photoshop CS4 to align the focused portion of each image into one final-and-focused image. It is a really simple technique that everyone can use on their photos.

In the mean time, here’s what I needed:

1. A very very very very steady tripod. I’m not referring to those free tripods that comes with your DSLR purchase. Technically it works but i can bet a million bucks these tripods will give you hell before anything else. In my case i used a Manfrotto 055XPROB and Manfrotto 410 junior gear head. Both are, in my honest opinion, a very hardcore combination in terms of stability, durability and precision.

focus-stacking-Photo C.jpg

2. A macro lens. To achieve my desired composition, i had to go really close. This means that even if i am shooting at f/8, the depth of field remains shallow. Not to say that other lens won’t work but you probably will have to crop the shot and risk losing overall image quality. In my case, I was using a Canon EF 50mm f/2.5 compact macro paired with a LED ring light (not particularly useful on a sunny day though)

3. Super precision matt focusing screen for manual focusing. Locking your camera on a tripod means you cannot move the camera (duh) and rely on your in-camera focus points to focus different parts of the image. Here, i used a Canon Es-S focusing screen and paired it with my 5D Classic. Awesome screen for manual focusing may i add.

4. A lot of patience. I spent no less than 30 minutes under the sun (where the cactus was conveniently situated at the time of the day) just to get the composition, the tripod positioning and lighting right.

5. Last but not least, you need a proper post processing software to handle focus stacking. Thankfully, Adobe CS4 has that feature

Ok moving on to the shooting part of focus stacking. The shot you see about actually consist of four different shots aligned and merged into one single shot, thanks to Adobe Photoshop CS4.

Now let’s look at the four photos, notice how each of them is focusing at a different spot:

focus-stacking-photo D.jpg

focus-stacking-photo E.jpg

focus-stacking-photo F.jpg

focus-stacking-photo G.jpg

Hopefully by now, you get the drift. Basically i’m taking the focused part of each photo and merging into one sharp and focus shot.

Now with the four photos, here’s what you need to do with CS4:

  1. Create one file with all four layers stacked on each of in a linear arrangement. This means that you SHOULD NOT jumble up the sequence of focused image.
  2. Select all four layers, go to Edit>Auto align layers.
  3. Once the layers are aligned, go to Edit>Auto blend layers.
  4. Let’s the software run some processing and you will get an image with the sides slightly out of focused. This is caused by auto-alignment and auto-blending.
  5. Crop the image to get rid of the out of focused areas.

focus-stacking-photo A.jpg

See! It’s that simple.

Do go out and have some fun with focus stacking. Remember, a sturdy tripod really helps to make life easier here 🙂

PS: I stumbled upon this online discussion where people are calling focusing stacking the new HDR. Technically, they are right. HDR requires taking several bracketed shots and merged them into one shot while focus stacking required several (and differently) focused shots of the same subject and merge into one. Some of them also correctly pointed out that people are going overuse this technique just like HDR. Well, let’s just leave this topic for another day shall we?

About the Author: Chen Wei Li is a freelance photographer based in Singapore and is nominated for the Top Photography Blogger in Singapore Award. His portfolio can be viewed at He can also be found on Twitter as @bythewei

Read more from our category

Guest Contributor This post was written by a guest contributor to dPS.
Please see their details in the post above.

Become a Contributor: Check out Write for DPS page for details about how YOU can share your photography tips with the DPS community.

Some Older Comments

  • Rob February 23, 2013 11:18 am

    As Punchful mentioned, the main reason to use focus stacking rather than just stopping down is that although a small aperture will give greater depth of field, almost all lenses will suffer diffraction. as a rule of thumb the best/sharpest aperture for any lens will be between 2 and 5 stops from the widest available. once you get to f22 and higher then any gain of DOF will mean that your final picture will be softer because of the diffraction caused. to quote from

    Since the divergent rays now travel different distances, some move out of phase and begin to interfere with each other — adding in some places and partially or completely canceling out in others. This interference produces a diffraction pattern with peak intensities where the amplitude of the light waves add, and less light where they subtract. If one were to measure the intensity of light reaching each position on a line, the measurements would appear as bands similar to those shown below.
    Diffraction Pattern

    FOcus Stacking is incredibly useful when used for specific subjects and for people who cannot afford a tilt and shift lens.

  • bythewei January 9, 2012 10:35 pm

    Shaikh - Nope, I don't move the camera at all. At the composition stage I already took into consideration that I will lose about 10% of my shot around the sides. With CS5 and focus-stacking, you will lose about 10% of your image on the sides.

    Egor - I have no issues with the browsers!

    Guys, if you have more questions about focus-stacking, feel free to email me or tweet me. My email can be found on my website (too bad for you spammers).

  • KRISHNAKUMAR NAIR December 21, 2011 11:53 pm

    you could also try using a compact camera where you get sharper pictures and more depth of field even at f8.

  • Egor December 18, 2011 10:30 pm

    I'm really loving the theme/design of your weblog. Do you ever run into any browser compatibility issues? A handful of my blog readers have complained about my site not operating correctly in Explorer but looks great in Firefox. Do you have any ideas to help fix this issue?

  • Punchful November 8, 2011 07:18 am

    No one is mentioning the issues of diffraction that would occur at an aperture of f/22 or higher?

    It starts to be a problem at apertures as wide as f/16, depending on the lens.

  • shaikh imran June 28, 2011 04:08 pm

    well , I think this thread is dead, any way I have some doubt I want to clear lets see some body is listening or not ,
    I will ask very straight , when you are working on focus stacking do you move camera body to adjust you subject or not , suppose you are very close to subject and subject is cutting

    as this pera mention

    (3. Super precision matt focusing screen for manual focusing. Locking your camera on a tripod means you cannot move the camera (duh) and rely on your in-camera focus points to focus different parts of the image. Here, i used a Canon Es-S focusing screen and paired it with my 5D Classic.)

    than how you use macro rail ?

  • PeterB November 16, 2010 09:00 pm

    chen, please allow me to point to a common misconception you used here:

    " 1. Focal length. Essentially the longer your lens, the more shallow your depth of field is. "

    The decisive point is not the focal length of a lens but rather the magnifition factor you use. In practical terms, a longer and a shorter (focal length) lens achieve an identic depth of field at a given magnification factor (scale).

    regards, Peter

  • Ricardipus October 27, 2010 04:08 am

    Nice. Thanks for the straightforward summary of this procedure. There seems to be a lot of "mystique" around this (hm, another comparison with HDR!) but you've done a really nice job of explaining it.

    I've actually successfully done this with a camera sitting on top of a flat surface (rather than a tripod) and manually focusing on different points - CS4 seems pretty good at auto-aligning, even when there's been movement between the different photos.

    Thanks again,

  • John August 17, 2010 03:41 pm

    This is very details and informative post! Thanks Chen. You reminded of Singapore Botanical Garden during my few years stay in Singapore back then! I just stumbled into this site linked from another article related to focus stacking.

    One thing I noticed and though was the comment from another guest/member (ex-member?) called James who wrote this comments:

    "While a nice technique, this entry is poorly written and not the easiest to follow. Telling us to “read about lines of composition” instead of recommending a link or explaining it is really useless.

    Also, why not stop up to f/22 like other people have suggested? This entry makes me consider unsubscribing to DPS."

    I thought it's really rude to say that mate! It just showed the limited knowledge you got in photography. There are reasons for using focus stacking technique instead of just setting your camera aperture to f22 and I don't want to waste my time explaining you that. But I yeah I totally agree with you that you should unsubscribe as I don't think you belong in this group! - Cheers

    Again, thanks Chen for sharing your work!

  • Bruce July 30, 2010 01:39 am

    You can also do this with either PTGui Pro or TuFuse, both of which use Enfuse for exposure fusion. This can be used to merge together different exposure levels as well as doing focus stacking. I have also used it with different illumination modes, such as fusing with and without flash or different flash angles.

  • Johnboy July 13, 2010 06:14 pm

    Re. James' post:
    "While a nice technique, this entry is poorly written and not the easiest to follow. Telling us to “read about lines of composition” instead of recommending a link or explaining it is really useless.
    Also, why not stop up to f/22 like other people have suggested? This entry makes me consider unsubscribing to DPS."

    I disagree wholeheartedly with this comment. and judging by the list of thanks and compliments I'm not the only one! If James really finds this difficult to follow he needs to question his own (photographic and/or language) capabilities.

    By all means unsubscribe James, but before you do why not treat us all to one of your own 'well- written, easy-to-follow' tutorials?

  • mark July 9, 2010 10:43 pm

    wow! great tip

  • Michelle Armour July 9, 2010 06:41 pm

    Great stuff, I hope CS5 still has the feature, I jumped from CS3 to CS5. Thanks

  • Tammy July 9, 2010 04:29 pm

    Thanks for this article - it was well written and informative - and one of the better articles I've read on this site.
    I'm enjoying your own website as well.

  • Peter July 9, 2010 03:05 am

    Just as a point of interest, there is a program that does the stacking automatically. You can buy a yearly license or a one off payment. The program is called Helicon focus.

  • BCOT July 8, 2010 06:06 pm

    This is cool. As a amateur photographer, I'm trying to this of situations in which this would be a good idea besides the one you mention for this shot.

  • Tyler Wainright July 7, 2010 05:07 am

    Very cool - anyone know if you can do something similar in Lightroom?

  • David July 6, 2010 07:02 am

    Not really for using under the hot sun, but if you have laptop nearby or in home situation you can use automatic focus bracketing
    It works with EOS cameras, but I am not sure about yours.

  • bythewei July 5, 2010 11:59 am

    Hello Reynolds and Abraxas,

    If you remember the part where i wrote about three factors affecting DOF, you will realize that the closer you move your camera/lens towards your subject, the more 'bokeh' or blurred background there will be. This is especially so for macro lens because I am moving extremely up close to the cactus. Therefore even if i shot at f/16 or f/22, there will still be a certain amount of blurring on the photo.

    Secondly, i know that my lens performs really well at f/8 and f/11. Thus it was a personal decision to stick to f/8.

    As for the topic of HDR, like i said let's leave it for another day :)

  • Valerie July 5, 2010 09:01 am

    excellent. i'm going to give this a try. i read about something like this is an overseas photo magazine, but it applied to getting a landscape in sharp focus front to back....easier if one can't remember other techniques.

  • Gord July 5, 2010 01:49 am

    Rick - Try it without your macro rails. They would change location of the camera slightly, and thus the perspective. Maybe this is causing your ghosting issue in areas where PS is blending the multiple layers together.

  • James July 5, 2010 12:28 am

    While a nice technique, this entry is poorly written and not the easiest to follow. Telling us to "read about lines of composition" instead of recommending a link or explaining it is really useless.

    Also, why not stop up to f/22 like other people have suggested? This entry makes me consider unsubscribing to DPS.

  • Les Reynolds July 4, 2010 09:08 pm

    Was thinking the same thing as Abraxas. Why not just go to f/22 or 32 and use a longer shutter speed. You already have a the camera on a tripod.

  • EdSarmiento July 4, 2010 04:37 pm

    Great article, a technique must try for my self and see the result thanks for sharing.

  • abraxas July 4, 2010 07:38 am

    Is there a reason why you didn't use simply a long exposure time and small aperture?

  • ben July 4, 2010 07:09 am

    this was very informative, thank you. I have started shooting a good deal of landscapes with long exposures and small apertures. Why not just try the shot at F20-F30? I am sorry if this question means I am missing the point.


  • Guillermo July 3, 2010 09:26 am

    Its great that you can do it in Photshop but Focus-Stacking deserves dedicated software... I dont see the point of a Photoshop Tutorial for focus-stacking at all...

    You should post a tutorial for proper focus-stacking software like:

    -Helicon Focus (commercial)
    -CombineZM (no cost)
    -Tufuse (no cost)

    You can check this tutorial (spanish, you can use google translate):

  • Will July 3, 2010 06:47 am

    I agree with JohnK's last point, that this technique most likely wil not result in images that look fake. At worst, it's like a really sharp pinhole lens.

    One question, though: What is the result if you use this technique with focused images for the extremes, but leave the middle distance out of focus? For example, one image focused on a flower at .3 m, and one on the clouds at infinity, but you have a person in the frame at 3 m.

    Anyone seen examples of this? Could be interesting, but might look too fake.

  • JohnK July 3, 2010 06:05 am

    Great article Chen. Very well written, organized and informative. I think I may even try this technique.

    Kyptonite: Not sure what you mean by "overused"? HDR is stacking "exposures" while the technique in this article is stacking "focus points". They are trying achieving two seperate objective which the human eye naturally performs much better than a camera.

    While I do agree that HDR can be "overdone", I do not think it is necessarily "overused". If HDR is used subtly to expand the dynamic range of an image so that the image more naturally mimics what the human eye sees by expanding the details in the highlights and shadows, I think it is a great technique, much like focus stacking. The controversy comes in when HDR is pushed to an extreme and the image looks more like a painting or graphic artist's representation of the actual scene. At its extreme one has to question whether it is still a photograph or piece of graphic art.

    Since focus stacking cannot be "overdone" (ie. you can't make an image "too focused") it will not likely result in an image that could not be perceived by the normal human eye.

  • Josh July 3, 2010 05:07 am

    Fantastic image and fantastic article! I hate photography articles that skip the details and go right to the end result. You gave a very clear description of your proccess step by step. Thank you for that!

  • Jen at Cabin Fever July 3, 2010 05:05 am

    Very cool! While reading this I kept thinking just how similar it is to HDR. Much of my work actually is HDR and I disagree that its overused. I think that its misused... but you're right. That's a discussion for another day :)

    NEK Photo Blog

    Cabin Fever in Vermont

  • Phillipa Chan July 3, 2010 03:47 am

    Thanks for sharing !!

  • Kyrptonite July 3, 2010 03:37 am

    Wow, that is actually pretty cool. I think that even if it gets overused it will still be better than HDR. HDR is so fake; this looks real and has quality.

  • Rick July 3, 2010 03:32 am

    I've spent a lot of time trying this technique. I've got the equipment, Nikon D3 with 105mm macro, Feisol CF tripod and head, macro focusing rail (said to be the best way to adjust focus). I've tried PS and CZ. I've consistently gotten either (1) problems in PS with areas of low contrast, the proper image sometimes does not get selected (not an issue in the posted image, not much low contrast there) or (2) "ghosting", where extra lines appear around high contrast edges. Not sure where to turn, as I know people are getting great results with this approach.

  • darren_c July 3, 2010 01:35 am

    What a really interesting technique. I have used the auto-align and blend features before but not this way.

    Chalk this up to something I learned today that I didn't know yesterday.



  • Anthony July 3, 2010 01:21 am

    Great article! I didn't know it was that easy with PS... I'll have to try this with some macro shots. As for HDR I'll have to take the other side of the argument; sure you may be bracketing and merging similar to HDR methods but you aren't adjusting the exposure like with AEB - it's more like focus bracketing which has to do with the DOF, not increasing the dynamic range. Just my $0.02.

  • Gloson July 3, 2010 01:11 am

    Great tips, Chen! A very creative idea! I've never thought of that! :-)