Major advantages of astrophotography stacking in Affinity Photo

Astrophotography workflows just became more streamlined with Affinity Photo 1.9’s addition of an Astrophotography Stack Persona. Let’s explore some of the app’s key advantages when it comes to stacking and retouching astrophotography images.

Affinity Photo 1.9 has not long been released and has brought with it a healthy mix of new features and quality of life improvements, but perhaps the most exciting addition for myself was the new Astrophotography Stack Persona.

I’m a keen amateur astrophotographer, so needless to say, I was very excited to try out the astrophotography stacking functionality when it first arrived in a beta build. I went out of my way to record six full-length workflow tutorials for launch, as I really want any astrophotographers who try the app to be able to take advantage of Affinity Photo’s benefits and not just adapt an existing workflow from certain ‘other’ software!

Tarantula Nebula as a bi-colour HaOIII composition

With that in mind, I wanted to illustrate some of Affinity Photo’s key features and functionality that can enhance astrophotography workflows, and hopefully give you some alternative ideas about how to approach the various techniques used in this type of image editing.

Please don’t forget to check out the various tutorials on the Affinity website or on YouTube. There are full-length workflow videos that cover stacking right through to final retouching, and videos that focus on specific techniques like background removal and colour equalisation.

Live filters

Live filter layers are one of Affinity Photo’s most powerful features and a major contributor to maintaining a non-destructive workflow.

Think of them as adjustment layers that apply filter effects instead—you can add them in your layer stack, composite them above or underneath other layers, change their parameters at any time, control their blending and also mask them.

Live Filters being used to apply star reduction and structure enhancement non-destructively.

If you wanted to have a completely non-destructive layer stack where no layer merging is required, here are just a few techniques you could apply:

  • Star reduction (Minimum Blur)
  • Sharpening (High Pass, Unsharp Mask)
  • Star glow (Gaussian blur with Overlay blend mode and blend ranges/opacity)
  • Structure enhancement masked to just specific areas (Clarity)
  • Live star and background masking (Procedural Texture)
  • Luminance and colour noise reduction (Denoise)
  • Mesh distortion and liquify effects (Liquify)
  • Highlight brilliance (High Pass with a Hard Light blend mode)

… the list goes on! In particular, Affinity Photo’s Procedural Texture filter allows you to achieve all kinds of additional functionality if you’re handy with mathematics, and it is, of course, available as a live filter so you can apply it non-destructively.

Streamlined stacking process

The process of stacking your initial data along with calibration frames can be complex and also quite daunting for beginners.

Affinity Photo strikes a balance between offering enough customisable parameters for advanced users, yet keeping the interface lean and straightforward. At its most basic level, you simply add your light frames and calibration frames using the Type dropdown, click Stack and then apply your stacked result to move back to the main Photo Persona (workspace), where you can work on your image further.

The Astrophotography Stack Persona: lean and straightforward.

For more advanced stacking, you have control over settings and additional tools such as:

  • Stacking method: Sigma clipping with threshold/iterations, Average or Mean.
  • File groups for stacking data from different sessions (that may require different dark and flat frames).
  • Configurable background calibration to normalise background values between each image.
  • Manually setting the FITs/RAW bayer pattern.
  • Choosing between Affinity Photo’s bespoke demosaicing (sharper, fewer false colour artefacts) or a Bilinear implementation.
  • Setting white balance based on daylight (D65), the image metadata or inferring it from the master flat (applicable for one shot colour workflows).
  • Light frame analysis to select a percentage of best light frames—good for rejecting frames with star trailing or poor focus.
  • Bad pixel map tool: alter the threshold for determining hot and cold pixels from the calibration frames, and also manually add bad pixels and column defects to the bad pixel map. Save and load bad pixel map presets so you can easily re-use them for future data.

If you’re completely new to astrophotography post production, Affinity Photo is definitely not a bad choice for keeping things straightforward and manageable whilst you learn the stacking process.

Additionally, the whole process is documented in the Help—available offline through the app and online at https://affinity.help/photo/.

Retouching tools, selection tools and blending options

The Orion Nebula, processed from a one shot colour setup using various adjustments and live filters.

Affinity Photo includes a variety of tools that work well with astrophotography retouching techniques. Let me run through a few common workflows and how you can use Affinity Photo’s tools to achieve them:

Removing difficult background tones

In addition to the stacking functionality, version 1.9 also introduces a dedicated Remove Background filter for astrophotography, which can be used to tackle difficult background gradients or simply neutralise a background colour.

To use:

  • Once you have performed tone stretching and any additional tonal work that reveals the gradient, go to Layer>Merge Visible to create a merged Pixel layer of your work so far.
  • With this layer selected, go to Filters>Astrophotography>Remove Background.
  • You will see a sampler in the middle of your document. Click-drag this and reposition it over an area of the background—try and avoid any star detail as this may interfere with the colour sampling.
  • On the dialog, enable Sample colour at handle. The Grey, Red, Green and Blue sliders will now change to reflect an average of the colour values where the sampler is positioned.
  • (Optional) For gradients, single click on the document to add more samplers and reposition them to build a gradient ‘profile’. Try not to use more samplers than is actually required, as you may accidentally introduce synthetic gradients!
  • (Optional) Raise the Output black level slider to bring the subtracted background tones away from pure black. This is for aesthetic purposes, but can also help to avoid clipping these tones and discarding potential faint detail.
Before and after comparison of the Remove Background filter being used to neutralise a gradient.

Non-destructive inpainting (content replacement)

Even with a bad pixel map generated from dark frames, you may find the occasional stray hot pixel or other artefacts in your images—issues like dust spots (from lack of suitable flat frames), column defects, and light trails are quite common in astrophotography. Affinity Photo has an Inpainting Brush Tool which can be used to intuitively remove these artefacts, and you can use it non-destructively without ever touching the original data layers.

  • On the Layers panel, create a New Pixel Layer above your data pixel layers but beneath any adjustments or other layers (e.g. tone stretching adjustments).
  • From the Tools panel on the left, select the Inpainting Brush Tool (J). It’s on the retouching tools flyout, which by default will show the Healing Brush Tool.
  • On the context toolbar at the top, change the dropdown option from Current Layer to Current Layer & Below.
  • With your new pixel layer selected, brush over the areas you want to replace. These areas will be sampled from the data layers, but the result will be added to your new pixel layer instead.
  • Having the inpainted data on your new pixel layer means you can hide it or erase away certain areas if the result is sub-par: you haven’t overwritten any of your original stacked data.
Non-destructive Inpainting where pixel content is sampled and replace on a separate pixel layer.

Star reduction

Stars can be a tad overpowering after tone stretching, especially for broadband imagery. There are various techniques to reduce their visibility and brightness. Here’s a useful, consistent approach that works well:

  • Create a temporary merged layer (Layer>Merge Visible).
  • Use Select>Select Sampled Colour. Change the Model to Intensity and single click on a bright star, then adjust Tolerance as required to select the star detail in your image.
  • Optionally, use options like Select>Grow/Shrink and Select>Feather to refine your star selection.
  • Now add a live Minimum Blur filter (Layer>New Live Filter Layer>Blur>Minimum Blur) and try a Radius value between 2-4px to begin with. You now have a non-destructive filter that reduces star detail.
  • Alternatively, try an HSL adjustment (Layer>New Adjustment Layer>HSL) and reduce the Luminosity slider to dim the star detail.
  • Don’t forget to deselect (CMD+D on Mac, Ctrl+D on Windows) to get rid of the selection marquee! You can also now delete the temporary merged layer.
Star reduction performed using Photo’s selection tools and live filters.

Non-destructive structure enhancement

Sometimes we want to ‘tease out’ nebula detail and make it more prominent, especially if it’s fighting against star detail in the image. In Affinity Photo, we can do this non-destructively anywhere in the layer stack:

  • Add a live Clarity filter by going to Layer>New Live Filter Layer>Sharpen>Clarity.
  • Live filters ‘nest’ or ‘child layer’ into the previously selected layer by default—just drag the Clarity layer out into the parent layer stack.
  • Adjust the Strength slider to enhance structure within the image.
  • (Optional) To mask the effect, go to Layer>Invert to flip the Clarity layer’s mask to pure black. Now paint back in over areas where you want to apply structure enhancement using the Paint Brush Tool (B) and a pure white colour.
  • (Optional) To blend the effect out of highlight tones (which avoids enhancing/brightening star detail), open the Blend Ranges dialog by clicking the cog icon next to the blend mode dropdown. Now adjust Source Layer Ranges and create an inverse S-curve which will exclude the layer from blending with brighter tones (pictured above).

Don’t forget to try moving the live Clarity filter around in the layer stack—you will find that the effect varies before or after tone stretching, or other tonal adjustments. Have fun and experiment!

Non-destructive structure enhancement using a live Clarity filter, which has also been masked.

As we are about to discover, Affinity Photo can offer its full range of tools, adjustments and filters when working in a 32-bit linear unbounded colour space.

32-bit linear workflow

One of the more technical benefits of using Affinity Photo is that you can work from start to finish in a 32-bit unbounded linear colour format.

To sum it up quickly, you can typically edit in three different precision formats with image editing software: 8-bit, 16-bit and 32-bit. This determines the number of unique colour values available for each channel (red, green, blue).

8-bit, for example, gives you 256 unique values (2^8). 16-bit gives you 65,536. 32-bit gives you billions of possible values, but instead of expressing this format with integer numbers, we use a floating point 0-1 range, where very precise values such as 0.002 and 0.864 are possible. This also allows for HDR values greater than 1, but we’ll come back to that another day!

For astrophotography, the more precision the better. Pretty much every image requires initial tone stretching, where you are taking colour values that are incredibly close together and pulling them further apart—sometimes tone stretching needs to be very aggressive and may involve multiple adjustment layers such as Levels and Curves.

Imagine trying to separate tones with a limited 8-bit range of values (0 to 255). There simply isn’t enough resolution there to stretch these values without introducing banding. Even 16-bit (0 to 65535) is not sufficient in some cases.

Left: Tone stretching in 8-bit. Right: Tone stretching in 32-bit. Quite a dramatic difference!

This is why most astrophotography workflows involve doing the initial tone stretching in 32-bit, where you have that huge range of values to pull apart without introducing artefacting like banding.

It’s at this point, however, where Affinity Photo diverges from certain other software, where you might tone stretch in 32-bit, then have to flatten and convert to 16-bit in order to continue editing with all the main tools, adjustments and filters you would require.

Affinity Photo, with the exception of its Bilateral and Median blur filters, offers its full suite of adjustments, live filters, filters and tools in 32-bit. Along with Snapshots, this means you can stack, tone stretch, retouch and export without ever having to merge down, convert your document’s colour format and save multiple copies.

Linear vs non-linear

Working in 32-bit is almost the same as working in 16-bit or 8-bit. The one key difference that may cause some confusion is that 32-bit works in a linear colour space, as opposed to a gamma-corrected non-linear colour space.

However, with the exception of some adjustments and filters appearing to be more ‘sensitive’, this difference is mostly taken care of in the background and the user doesn’t have to worry about it.

Left: Linear, scene referred values. Right: Non-linear, gamma corrected values.

Let me address one observation, however. I received a few emails from users asking how to access the ‘original’ or ‘unstretched’ data, explaining that even without the initial tone stretching, the pixel data appeared grey and washed out, then it hit me—they’re referring to the linear, scene referred data that you would typically see in other software.

Affinity Photo does a clever little thing in 32-bit: although everything is composited in linear space, there is a final gamma-corrected view transform that is applied when you see your document on screen, which matches how it will look when converted/exported to 16-bit or 8-bit.

This is really useful! You can edit your entire document in 32-bit linear, taking advantage of the extra precision it offers, then export at the end and your final exported result will look exactly the same. There is no tone mapping or tone adaptation required—what you see is what you get.

If you wanted to see your linear data, you could enable the 32-bit Preview Panel (View>Studio) and change the Display Transform setting from ICC Display Transform to Unmanaged.

Beware, however—you will absolutely want to be using ICC Display Transform when retouching your image unless you want a shock when you export and find your result looks too bright and washed out!

Snapshots

The ability to save and load ‘snapshots’ is a quiet and unassuming feature, not exposed by default on Affinity Photo’s user interface!

Snapshots allow you to store multiple document ‘states’ or revisions within one document file, foregoing the need to save multiple documents every time you want to experiment and try something different. Once you have saved your snapshots, you can easily load and move between them.

There is no limit on how adventurous you can be with snapshots. You might simply want to store different final crops and sharpening parameters for various platforms (e.g. Instagram, your website, printing), or you may want to experiment with different false colour compositions, for example, SHO/HSO/HOO colour palettes.

To use Snapshots:

  • Enable the Snapshots panel from View>Studio.
  • Click Add Snapshot (the second button along), and a dialog will prompt you to name your snapshot—this is initially filled with the date and time.
  • Repeat this process for any subsequent edits you want to save as different versions.
  • Load a snapshot by selecting it in the panel and clicking Restore Snapshot (the first button along).
Taking advantage of Snapshots to save different false colour compositions (HSO, SHO, HaOIII bi-colour) within one document file.

It’s also worth noting that Affinity Photo has an Undo Brush Tool that can paint in from a selected snapshot. You will see small camera icons to the left of each snapshot name—simply click one to mark it as active, then you can paint onto a Pixel layer with the Undo Brush Tool, and it will paint in from that snapshot. You could certainly achieve some interesting combinations of different edits using this!

Procedural texture filter

If Affinity Photo just had a destructive version of this filter, that would be reasonably useful. The ability to apply Procedural Texture as a live, non-destructive filter is what really elevates this to the next level, however.

I’ve had a lot of fun in my spare time since this filter was first introduced! (I may be a slight nerd…)—not just with astrophotography, but with all types of imagery and workflows. I enjoy recreating effects and workflows from other software using the Procedural Texture filter and occasionally other live filters, demonstrating that Affinity Photo can not only fulfil these requirements but also achieve them in a non-destructive fashion with no need for layer merging or ‘smart’ functionality. I use this filter extensively in my Astrophotography macros for some very useful workflow enhancements.

Essentially, you can use a series of functions and string together equations that operate on pixel values—you can target individual channels (including the alpha channel) or treat them cumulatively to achieve some very useful results and techniques.

This filter has some very handy applications for astrophotography. How about a completely non-destructive colour preserving tone stretch?

Left: Tone stretch using a traditional Levels Gamma transform. Right: Colour preserving tone stretch using a live Procedural Texture filter.

With this equation, a weighted luminance calculation of the RGB pixels is tone stretched then multiplied against the linear colour data, before being divided by the unstretched luminance. The result is a non-linear tone stretch that preserves much more colour integrity than a traditional Levels & Curves tone stretch.

We can also achieve some incredibly useful masking techniques with Procedural Texture, such as creating dynamic masks of star detail or background detail.

Creating a non-destructive star mask using a live Procedural Texture filter.

Here I’ve created a weighted luminance calculation, then used additional functions to smooth and clamp the matted alpha data, giving me the ability to control the mask threshold non-destructively.

This live Procedural Texture filter could then be masked to a group containing adjustments or other layers, making it easy to have an entire layer setup dedicated to just star detail—the bonus being, of course, that this mask can be altered just by moving a slider at any time during the editing process.

Inverting the weighted luminance calculation would then allow us to produce a background detail mask, meaning we can also apply techniques like brightness or colour reduction to the background areas non-destructively.

You can also mask live filters or change their blending options, so we could use a Luminosity blend mode and bring through R, G and B data in a mixed contribution to selectively enhance luminosity—in other software, we would have to create greyscale channel data from the initial pixel layer data, which then becomes a destructive process.

This filter provides us with so many workflow possibilities! To explore them all would probably occupy a whole article, so we’ll have to be content with just a few examples for now.

Final words

I hope this article has given you some insight into why Affinity Photo is a capable solution for astrophotography post production. It remains early days for the feature set and will, of course, not be suitable for every workflow, nor will it meet the needs of every astrophotographer, but hopefully its powerful functionality and notable advantages will spur you on to give it a try.

Don’t forget that you can obtain a free trial of the software, or purchase it outright (no subscription). See our dedicated Affinity Photo website page for more information.

As mentioned at the beginning of the article, don’t forget that we have comprehensive tutorials on astrophotography stacking and retouching on the Affinity website and on YouTube.

Clear skies!


Product expert
James is the voice of Affinity Photo and creates most of our Affinity Photo tutorial videos as well as providing in-house training. A self-proclaimed geek, James’ interests include video, programming and 3D, though these are eclipsed by his passion for photography which has now reached an obsessional level.
Credits & Footnotes

Astrophotography data acquired using remote telescope hosting services (iTelescope, Telescope Live) and own equipment.

Astrophotography images stacked and edited by James Ritson.