How To Stack Images In Photoshop For Astrophotography

Image stacking is the only way to reduce (random) noise in an image while boosting the details. This is because the technique aims to improve the signal to noise ratio of an image.

While image stacking can be used with any image, it is essential to astrophotography, as it lies at the core of the editing workflow for any kind of astrophotography, whether you are imaging a star field image from a fixed tripod or shooting at the Moon handheld.

In this article, you will learn to stack images directly in Adobe Photoshop.

Masking the foreground with a soft brush
Part of the process of stacking images in Photoshop.

How To Stack Pictures For Astrophotography In Photoshop – Step by Step

Let me be clear here: if you are serious about photographing the night sky, there are much better alternative software to Photoshop (see later).

On the other hand, if you are an occasional shooter, you have only a few images to stack, or you already know Photoshop well, there is nothing wrong with using it.

If you want to have a go with Photoshop, here are some of the shortcomings you may face when stacking astrophotography images:

  1. You cannot pre-process your light frames with dark, bias and flat calibration frames.
  2. Auto-align layers will rarely work with our kind of images, and you have to align the images manually.
  3. With starry landscapes, you have to manually mask the foreground and the sky to align those areas independently.

Here is a step-by-step workflow for a starry landscape. We chose this test case scenario because it includes all the steps you would perform for stacking planetary (Moon for example) and deep-sky images.

For this example, let’s consider a sequence of 10 images taken with my pocketable compact camera Sony RX100 Mk ii of this starry landscape.

single image from a sequence
Single image from the sequence used in this example.

All images were taken at f/1.8, 24mm,15 seconds exposure, and ISO 6400 from a fixed tripod.

Step 1: Load Your Images Into Photoshop As Layers

When you shoot for astrophotography, you should have your camera set to save images as RAW. If you load the RAW directly in Adobe Camera Raw (ACR), you will not be able to open them into photoshop as layers.

Instead, open Photoshop and go to File -> Scripts -> Load Files into Stack …

The following dialog window will open: click on Browse to select all the images and click on OK to open the images as layers.

dialog window to load images as layers
The dialog window to load images as layers.

Step 2: Load The Images For The Foreground

If you have photographed the sky while tracking for the stars, this is the time to load in Photoshop the images you took for the foreground. Do this by repeating Step 1.

On the other hand, if like me, you have photographed the landscape from a fixed tripod using the 500-rule (or similar), then you need to duplicate all layers. This way, we can have a set of images for the background and a set of images for the sky. 

Do that by selecting all layers and by dragging them on the icon next to the bin, at the bottom of the Layers panel. 

You can then regroup these layers in a group called “Sky” by dragging the new layers on the folder icon at the bottom of the Layers panel.

Step 3: Stack The Images For The Foreground

It is now time to stack the images for the foreground.

  1. Select all the layers and convert them to Smart Object with Layer -> Smart Objects ->Convert To Smart Object.
  2. Average the images in the stack by choosing Layer -> Smart Objects -> Stack Mode -> Mean

This process produces a much cleaner image, but the details in the sky will be smoothed out by the averaging process as stars moved with respect to the foreground during the capture of the image sequence.

Stacked van image for the foreground
Stacked image for the foreground.

Step 4: Align The Images For The Sky (Auto-Alignment Or Manual Alignment)

In this step, we will align the images for the sky to regain the missing details in the previous stack. 

The first thing to do is to mask the foreground in all the layers in the group named sky. For this, you can use your favorite method: I use a soft brush.

  1. Make sure the only visible layer in the project is the first one in the group named sky: this will make it easier to create the Mask.
  2. Add a Layer Mask to the layer and select a soft brush. Using the color black, star painting out the foreground, and a bit of sky next to it.
Masking the foreground with a soft brush
Masking the foreground with a soft brush.
  1. Alt+click on the mask thumbnail to make it visible on screen: check the masked foreground is solid black. Next, select the Mask (ctrl+a in Windows or cmd+a in Mac OS X) and copy it (ctrl+c in Windows or cmd+c in Mac OS X). While pressing the Alt key, drag the mask thumbnail over each sky layer to mask all layers. Add the Mask also to the group, as you will lose the ones for the layers when you create a Smart object later on. 
  2. We will give a try to auto align layers: make all sky layers visible, select them all and go to Layer->Auto-Align Layers, then use Auto align mode. Hopefully, you will not get any error messages saying the layers do not overlap enough.

To test the alignment, repeat Step 3 on the layers for the sky, but use blending mode Median instead of Mean, as it is more robust against non-perfect alignments.

In my case, the alignment was rather imprecise near the horizon, and the stacked image has stars smoothed out in that area. If you have the same problem, undo the Median blend mode and the Smart Object creation: we will proceed with a manual alignment.

photoshop Auto-align process in action
The Auto-align process in action.
  1. If the auto-alignment fails, it is time to turn to the rather lengthy and tedious manual alignment. The idea is the following:

    All layers will align to the first layer for the sky: this is your layer of reference. From now on, you will work with two frames at a time. Toggle off the visibility of all sky layers except for the reference one.

    Now, make visible the first layer and choose blending mode Difference. The image will change to black and white: what is black is aligned to the reference layer. What is white is not aligned.
Blending mode in photoshop
Difference Blending mode.
  • Use the Transform tool (ctrl+t in Windows or cmd+t in Mac OS X) to begin deforming the layer to improve the star alignment. You can switch back and forth between Transform and Warp modes to have the best possible global alignment.
  • As a general rule, concentrate more on aligning the center of the image: you can always trim the edges later on, if you cannot align them properly.
manually aligned frame
Example of manually aligned frame.
  • When you are satisfied with the alignment, confirm the transformation, set the blending mode for the now aligned layer back to Normal, and toggle off its visibility.
  • Repeat this process for all the layers.

Step 5: Stack The Images For The Sky And Blend With Foreground

Finally, it is time to stack the layers for the sky and blend it with the stack we created for the foreground.

  1. Make sure you have the layer mask applied to the group (if not add it) and toggle on the visibility for all sky layers;
  2. Create a Smart Object as in Step 3 and use the Blend Mode Median to create the stacked image. 
  3. If the alignment was ok, you should have many stars and details in the stacked image. If not, undo the blend mode median and the smart object creation and refine the layers alignment.
  4. Once happy with your sky, toggle on the visibility on the foreground layer and tweak the Mask so that the two layers blend seamlessly.

Step 6: Final Tweaks

When happy with the result, you can now create a snapshot (Alt+Ctrl+E on Windows or cmd+alt+E with Mac OS X), trim the edges of the image and edit it as you please to produce the final image.

comparison of single and stacked image in photoshop
The final image (right) is much cleaner than the single exposure (left) and has better details in the sky.

Alternative Astrophotography Software For Image Stacking

Before you go, here is a list of notable stackers specific to astrophotography. To know more about them and other useful software you can refer to this article.

Starry Landscape Stacker
Starry Landscape Stacker, Commercial, Mac only

In this video, I show how to stack the images used in this article with Starry Landscape Stacker.

Sequator
Deep Sky and Starry Landscape Stacker – Free – Windows Only

In this video, I show how to stack the images used in this article with Sequator.

Other Stackers

DeepSkyStacker (DSS)
Deep Sky Stacker – Free – Windows Only

Autostakkert!3
Planetary Stacker – Free – Windows Only

SiriL
Planetary and Deep Sky Stacker – Free – Mac, Windows, Linux

Conclusions

Image stacking is a crucial step in the astrophotography editing workflow to improve the image quality by reducing noise and boosting details.

In this article, we have discussed how to use Photoshop for image stacking of starry landscapes, and here is a great video tutorial from Lonely Speck.

img-11
About Andrea Minoia

Andrea Minoia works as a researcher in a Belgian university by day and is a keen amateur astrophotographer by night.

He is most interested in deep sky photography with low budget equipment and in helping beginners along their journey under the stars.