Photography – How To Perform Focus Stacking In Photoshop

Focus Stacking is a technique where you take multiple photos of the same scene with different parts in focus and then combine them into a single image with everything (or whichever parts you want) in perfect focus. It may sound complex to do but is actually very simple to do in Photoshop.

Lets see how we can perform focus stacking. I have three images with me, each having a slightly different area in focus.

focus1  focus2


If you open these images you’ll see that the first image has the outer part of image in focus, second image has middle and third image has central part in focus. We’ll now see how to perform focus stacking on these images. I’ll use Photoshop CC for this but the steps should be same for older versions too.

Step 1 – Open Photoshop, choose File > Scripts > Load Files Into Stack… and choose the photos that you want to stack. Make sure to check the “Attempt to automatically align source images” at the bottom of the dialog box. This option aligns images in case there was a slight movement of the camera. Click Ok.

Screenshot (186)

Screenshot (187)

Photoshop will now open the images and load them int a stack.

Step 2 – Now select all layers from layers panel and choose Edit > Auto-Blend Layers…. Select “Stack Images” and check “Seamless Tones And Colors”. Click OK and allow Photoshop to find the areas in focus in each layer.

Screenshot (189)

Screenshot (190)

Screenshot (191)

You’ll now see that Photoshop has applied a mask on each layer. This mask generated by Photoshop is used to display only in-focus areas from each layer. Manually creating such mark would have been a difficult job if there were dozens of images.

Final image –


You can now flatten layer and save the stacked image in your favorite format.


Photography – How To Fix Leaning Buildings using Photoshop

If you’ve been taking photographs for some time then you must have experienced (sad if you haven’t) that buildings or any tall structures near the edges of frame appear leaning. An example of this is a picture I took on a recent trip to Delhi –


You can see that the India Gate is leaning left by quite some degrees. You can also notice that the part of the building nearer to the right edge is leaning more than the opposite part. This is because of the very reason such leaning happens – lens distortion. Lens distortion causes parts of the image nearer to the lens edges distorted due to the optical qualities of the lens. The farther the object or the wider the field of view, more prominent this effect becomes.

Now lets see how we can fix images affected with this. I’ll be using Adobe Photoshop CC but the same steps should apply to older versions too.

Step 1 – Open your image in Photoshop.

Step 2 – Select Filter -> Camera Raw Filter from the menu bar or press Shift+Ctrl+A.

Step 3 – Switch to Lens Correction tab (6th icon from left) in the right panel. Switch to Manual in the tab that opens below.

Step 4 – Slide the slider labeled Vertical left or right depending on which side is you image leaning. Slide left if your image is leaning left and right if your image is leaning right. Click OK to apply.

Screenshot (181)

The end result after cropping –


This may leave blank areas in the image. You can either use content aware fill to generate pixels if there isn’t much variations in image or crop those areas out. You may also want to decrease image’s height a bit to compensate for the vertical stretch introduced. You can use Transform (select then press Ctrl+T) for that.