Expert astrophotographer Will Gater provides a beginner’s guide to layers-based image editing
As any astrophotographer will tell you, the cold nights that are spent out capturing data – whether for a simple DSLR camera nightscape or a multihour deep-sky masterpiece – are only the opening stages of a long journey to produce a final image. An enormous amount of work goes into the processing of even quite a simple data set. We may think of stacking and calibration software programs – like DeepSkyStacker or Nebulosity – when we hear the phrase ‘astro-image processing’, but often much of this work is done in Photoshop or GIMP too – certainly more than a few final tweaks.
These programs allow you adjust different aspects of an image (like the brightness, contrast and colour balance), but they’re also important in another respect, as they are what’s known as ‘layers-based’ editors. This means that multiple images, or sets of image data, can be brought into these programs as separate layers.
You can think of regular image-editing programs as being similar to the process of painting, where each daub of new paint is added to the canvas, changing the overall image. But a layers-based editor allows multiple, individual layers to simultaneously combine to make the image on screen. Each of these also can be tweaked, adjusted, masked, aligned or blended in myriad ways while processing.
Because each image layer can be switched on or off, and has different treatments or processing techniques applied to it in isolation, it’s easy to vary its contribution to the overall picture, or even delete its effect completely. In the painting analogy this is akin to having the ability to remove, tweak or even change the hue of paint strokes that have already been applied to the canvas.
In a non layers-based editor, to go back and tweak an adjustment to part of the image, like a brightness boost or a curves enhancement, you will often need to restart the editing process, if such alterations are possible in the first place.
Abundant applications
For astrophotographers, the practical applications of layers-based image editors are numerous. A basic example is the creation of manually stitched lunar mosaics. In such projects tens, if not hundreds, of frames – with different ‘footprints’ of the Moon’s surface – can be loaded as individual layers into a large digital ‘canvas’. Layers-based editing then allows them to be manually manipulated, aligned and blended to create a composite of the lunar disc, or a highlighted section.
Another common use of layers-based image editing in astrophotography is to blend two or more exposures, or images with different processing treatments or filters applied. This is often done with nightscapes and long-exposure, deep-sky imaging of bright targets.
In this article we will look at three introductory examples of how to use a layers-based editing programme in the scenarios above. We will only scratch the surface of what’s possible with these techniques; there are many more applications. These include high-pass filtering, creating animated GIFs, image stacking and blending, and even adding annotations to your images. Once you start using layers-based software your astrophoto processing workflow won’t be the same again!
Case study 1
Creating a manually stitched lunar mosaic
Making a lunar mosaic from scratch is a great way to introduce yourself to the basic mechanics of layers-based editing. Such mosaics are created by combining multiple, overlapping images of the Moon’s surface. While there are plug-ins and software that can do this automatically, manual composition in a layers-based program gives you full control over the process. In this example we will assume the individual frames begin life as video captures taken through a high frame rate camera and telescope.
STEP 1 CAPTURING THE FRAMES
Don’t just think about focusing and exposure, but also about creating the best possible data for manual composition. Give each video capture an overlap between neighbouring frames, as this makes it easier to match and align. Monitor how well your mount is tracking: if it’s not keeping the framing stable, thin gaps can creep into the final mosaic.
STEP 2 PREPARING THE DATA FOR MOSAICING
You can now process the videos from Step 1. First, open a video in alignment and stacking software such as the free AutoStakkert! Under ‘Image Stabilization’ (IS) be sure to select ‘Expand’ as this will ensure there’s space around the edge that we can make use of. Once AutoStakkert! has done its work, open the images in the free software RegiStax and apply gentle wavelet sharpening (left) before saving each file as a PNG.
STEP 3 START ALIGNING FRAMES IN THE LAYERS-BASED EDITOR
Now import all of your frames into the editor. In Photoshop this can be done by selecting ‘File > Scripts > Load Files into Stack’, while in GIMP it’s ‘File > Open as Layers’. Select the first two frames of your imaging sequence and start aligning them. In Photoshop you can move and rotate a layer using the ‘Move Tool’, while in GIMP you’ll have to use a combination of the ‘Move Tool’ and ‘Rotate Tool’.
STEP 4 EXAMINE THE QUALITY OF THE ALIGNMENT
Check the rotational and positional accuracy of the alignment. You can do this by examining the ‘Difference’ image of the two frames by setting the upper layer’s blending mode to ‘Difference’ in the ‘Layers’ menu. The closer the pixels in the ‘Difference’ layer match with those below, the nearer to solid black they’ll appear, making slight offsets noticeable. Use the arrow keys to nudge the frames, then switch back to ‘Normal’ blending when you’re done.
STEP 5 BRING IN ANOTHER LAYER AND REPEAT THE PROCESS
Now repeat some of the earlier steps by selecting another layer and aligning it to the co-aligned first and second frames. This will, of course, have to be done in sequence for all frames in their separate layers. If you notice a hard edge between frames – or frames that show poorer quality data than the one(s) underlying them – you can use a soft-edged eraser tool to remove it.
STEP 6 BALANCE LIGHTING BETWEEN FRAMES IF NECESSARY
The last task – before blending the image into a final, single composite that can be sharpened and tweaked further – is to even out any differences in brightness between frames that sit next to each other. Do this by making very small tweaks to the brightness and contrast of an individual layer, for example using the ‘Levels’ tool via ‘Colours > Levels’ in GIMP and ‘Image > Adjustments > Levels’ in Photoshop.
Case study 2
Blending data in nightscapes using a layer mask
There are many ways in which layer-based editors are useful when you are processing ‘nightscapes’. For example, they can be used to blend two or more images held in separate layers. A common example of this in nightscape imaging is when you are bringing two different exposures together, or perhaps two treatments of the same data. Here, we are going to look at how you would do that using what’s called a layer ‘mask’.
STEP 1 CAPTURE AND PROCESS THE TWO FRAMES YOU WANT TO BLEND
First capture and process the two images you want to blend. This could be one long exposure (or multiple stacked ones) at a low ISO for the foreground and a shorter one for the sky. It could also be two images made from just one exposure: one processed to bring out details in the starry sky and another, using the same data, where you’ve focused on brightening the foreground, eg with a curves enhancement. You can apply noise-reduction filters or vignetting calibration now, but don’t make levels or curve stretches too harsh at this stage.
STEP 2 BRING THE IMAGES TOGETHER INTO TWO LAYERS
Take one image and place it into a new layer in the other. In Photoshop click on ‘Select > All’, then ‘Edit > Copy Merged’, before pasting into the other image file. In GIMP, click on ‘Select > All’, ‘Edit > Copy Visible’, then ‘Paste as > New Layer’. Now, align the layers using the techniques discussed in Case Study 1. In some instances, especially if one exposure was taken minutes after the other, there may not be perfect alignment and there will be a small, insurmountable offset of a few tens of pixels due to the sky’s motion. Make an alignment and crop areas that don’t overlap.
STEP 3 APPLY A LAYER MASK TO BLEND THE LAYERS
Now apply a layer mask to make one layer visible ‘through’ the other. In our example, the image processed for the stars is the upper layer in the layers window. To add a mask in Photoshop click the black-circle-in-a-white-rectangle icon at the bottom of the ‘Layers’ window. In GIMP, right-click on the upper layer and click ‘Add Layer Mask’ and choose the ‘White’ option. In GIMP you now use a large, diffuse paint brush to ‘paint’ a mask and reveal the desired area of the underlying layer. In Photoshop you do the same, but with the eraser tool instead.
STEP 4 FINAL ADJUSTMENTS
You should be close to having a final image, with the desired parts of one layer showing through the other. You can now make tweaks to the brightness and contrast of the two layers. Now that you have isolated the different areas with a mask, you can make those adjustments to one layer or the other and can see ‘live’ how they affect the composition. When you’re happy, flatten the image – ‘Layer > Flatten Image’ in Photoshop, and ‘Image > Flatten Image’ in GIMP – to merge all the layers and make final global adjustments, eg colour balancing.
Case study 3
Using layers to deal with bright areas in deep-sky imaging
In this final case study we’re going to bring together many of the techniques we’ve explored in the previous two step-by-step projects. In deep-sky imaging, having the ability to blend together two data sets, or two different images, in separate layers can be very useful when tackling some of the brighter targets.
With objects like the Orion Nebula, M42, and the Andromeda Galaxy, M31, the core regions are quite bright compared to their surroundings. What this means is that if you set your exposure levels on your camera to pick up the faint detail in the outer regions of these targets, chances are the centre is going to be overexposed. Typically the way around this is to capture another set of shorter exposures of the central regions, then stack them separately; this data can then be blended with the other stack made from data exposed for the faint outer areas.
Let’s imagine we’re trying to combine the two images of the inner regions of M31 below. We’ve already seen how to bring two images into a layers-based editor and align them, and we could use a layer mask to then mask the overexposed core, allowing the data showing the central region to come through more clearly.
But there’s another way to achieve a similar effect. That is to change the blending mode of the two layers. With the data showing the overexposed core in the upper layer, we could set its ‘Blend Mode’ (at the top of the layers window in both Photoshop and GIMP) from ‘Normal’ to ‘Soft Light’. The result: a much better looking image, without the substantial blown-out core area, that can then be flattened down and processed to taste in numerous other ways.
Will Gater is an astronomy journalist and science presenter. His latest book, The Mysteries of the Universe, is published by DK