Astrophotography in the City – Part 3

In Part 2, I explained the steps involved in improving the signal to noise ratio (SNR) by stacking multiple images and removing camera sensor noise (DARK and OFFSET frames). In this third article I will deal with sky gradient removal and white balance.

IRIS is a powerful astrophotography tool, and learning how to use the numerous commands can lead to fantastic photos. You can find good documentation and procedures on the IRIS website, so I won’t go in too much detail here.

While IRIS can process images in 32-bit, it cannot open the 32-bit FIT files generated with DSS. With my image still opened in DSS from the previous step (or by opening the created by DSS), I select to save the image as a 16-bit FIT such that it can be opened in IRIS.

Below is the result in IRIS, and two things become apparent: 1) the sky has a gradient due to the light pollution from city lights; 2) the sky has a pink hue. These two elements will be corrected in this article.

iris sky gradient

Note, when I opened the image in IRIS, it was inverted, I had to flip it horizontally (menu bar – Geometry/Flip/Horizontal).

The sky gradient removal tool works best when two elements are addressed: 1) nice clean image edge, 2) the background sky is black

Trim the Edge

The image needs to have a nice edge around the border (i.e. be smooth all the way to the edge). Hence any dark bands, fuzzy or slopping edges needs to be trimmed. Zooming in on the left part of the image, I will trim at the yellow line, keeping the right-hand part.
photo edge trimming

Typing win at the command prompt within IRIS will give you a cursor to select the two corners to crop your image.

A Black Background

The background needs to be black and have an RGB value near 0. To do that, select a small area in a dark portion of your image, with no stars, and use the black command. This will offset the RGB values to be 0 based on the average within the square you selected. Essentially what you are telling the program is that the darkest portion of your image should be black.

White Balance

The sky gradient removal tool can also correct the background sky color, but before doing so, we need to adjust the white balance such that white stars appear white. To do this correctly you will need a star map (Cartes du ciel, C2A, Stellarium) and locate a star in your image that is as close to our own star color: G2V. This is not exactly for beginners, if you don’t know how, skip and do the white balance later in a photo editor. Once the star located, simply selected it with a small box and use the white command in IRIS.

We perceive a white piece of paper in sunlight to be white, hence light coming from a star of the same spectrum as our Sun should also look white in photos. It’s essentially a white balance exercise, but selecting a star in your image to calibrate instead of most programs which uses the average of the whole image.

Sky Gradient Removal

With that done, you can now select from the menu Processing / Remove gradient (polynomial fit) to get the following pop-up

remove gradient

If you have just stars in the image, a Low background detection and Low Fit precision will work.  However if you have intricate details from the Milky Way with dust lanes and all, then a High setting will better preserve the subtle changes. Try various combination to see what works best for your image. You can also do one pass with Low, and then follow it with a 2nd pass at High.

The result of all this is presented below: the sky gradient is gone, and the sky background is now a nicer black instead of a pink hue. And if you did the white balance, then the stars are also of the right color.


I should mention that the two most important dialog boxes in IRIS are the Command prompt and Threshold. When viewing and performing the various operations, the threshold values (essentially the min/max for brightness and darkness) often needs to be adjusted to get a good image and see the required detail.


The next step will be importing the file in a photo editor for final adjustments. Color saturation, levels and intensity can be adjusted in IRIS, but I find a photo editor to offer better control. And because I will continue my editing in a photo editor do not set the Threshold values too narrow. I prefer a grey sky and then do a non-linear adjustment in a photo editor to get a darker sky.

More to come in another article




Astrophotography in the City – Part 2

Continuing with my series on how to do astrophotography in the city…

In Part 1 I described how to set up the camera and take pictures for astrophotography. So if you’ve followed up to here you should have the following 40 images stored on your camera in RAW format.

– 20 LIGHT frames
– 10 DARK frames
– 10 OFFSET frames

The next step is relatively simple, entirely performed on a computer, you simply have to set it up with the right parameters, the right files and off it goes. The purpose is to register (align) the LIGHT frames and stack them to improve the Signal/Noise Ratio (SNR) such that we can adjust the dynamic range and “tune-out” the unwanted bright sky while keeping the stars.

Register and Stack

There are lots of software out there that can perform the task of registering (aligning) and stacking images.  They all look for pin-point stars in an image and use those as references to align your LIGHT frames such that when they are added, the pin-point stars all stack up correctly.

I’ve used three different software, all of which are free:
IRIS – Very powerful, but not exactly user-friendly. If your camera is 2015 and newer, it may not decode correctly the RAW files. However if you know how to use IRIS, the results can be quite amazing. I will still use IRIS, but that will be in Part 3.
Registax – Works best with planetary and lunar images, especially video is used instead of individual images. However cannot open RAW files.
DeepSkyStacker – (aka DSS) Simple to use, but the resulting image has to be post-processed in an image editor. This is what I use for the Canon 80D and what is described below.

With the Canon 80D, I have to use DeepSkyStacker as IRIS does not correctly decode the  Canon 80D RAW files. With my previous camera (Canon EOS Rebel XTi) I would have gone straight to IRIS for all the processing.

The first step is to open each of the LIGHT, DARK and OFFSET frames with DSS using the upper left menu.


Click on Open picture files and select your LIGHT frames. Then select dark files for your DARK frames and offset/bias files for your OFFSET frames. Once that is done, be sure to select Check all on the left-hand side such that all your files are selected and will be used for processing.

You should see in the lower portion of DSS all your images, tagged respectively Bias/Offset, Dark or Light. More importantly, they should all be checked-marked.


The next step is selecting the Register checked pictures from menu on the left which will bring up this pop-up.


Normally the default settings are good. Essentially DSS will remove the DARK and OFFSET frames from your LIGHT frames, look for stars in each and computer the translation/rotation required to align the stars frame to frame. There needs to be 10 or more stars in each LIGHT frame to be able to align and stack.  If that is not the case, it’s possible to play with the threshold in the Advanced settings in order to detect sufficient number of stars in your LIGHT frames.

After that has completed running, DSS will have evaluated all your images, selected the best one as your reference and unchecked any image that could not be aligned. Next is the stacking.  The following was established through trial and error with my Canon 80D.  You may experiment with different settings to see what each parameter does.

Upon selecting Stack checked pictures, and then selecting Stacking Parameters, the following is presented.

Standard Mode will align and stack the images without cropping.  By default this is selected, and cropping can be done at a later time in photo editing.

For wide-angle DSLR images, don’t bother with the Drizzle options. It’s only good when you want to focus on a small galaxy or nebula within your image. If you use this, you better to select an area of interest to keep the file-size and processing time small.

As a DSLR or consumer camera takes one-shot color images, no use to select Align RGB Channels. This would make sense with a monochrome camera, where individual color filters need to be used

The next tab, Light, is where you can have a good say on the final resulting image. Each setting controls how individual pixels are added between each LIGHT frame.


Average is the fastest, and most basic. However random events that show up in 1 or 2 frames like a satellite, meteor or a plane will still be visible in the final image.  This is a good setting for a quick preview of the final result.

Maximum is perfect when you want to do things like star trails, or see if among your many LIGHT frames you caught something a moving object such as a comet, asteroid, satellite or meteor. It essentially keeps the brightest pixel from each LIGHT frame.

I tend to use Median Kappa-Sigma clipping. For every pixel, it does a distribution of the intensity, and if in a frame that pixel falls out of the standard distribution, the pixel gets replaced by the median value.  It essentially avoids extreme values to mess things up, so  a plane passing in 1 or 2 images, or a satellite streaking by will be eliminated in the processing.  It also makes for more pin-point stars.  In the end, it removes random events from your picture.

From experience, a very important parameter to select is Per Channel Background Calibration.  Light pollution in the city tends to have a pink hue, and this can cause the final image to be skewed into the wrong color with the result being either too red, too green or simply grey.  By selecting Per Channel Background Calibration, each RAW image is decomposed in its RGB components and calibrated to have a BLACK background sky (because the night sky should be black, and not pink from high-pressure sodium lights).

The remaining parameters in the other tabs should be kept as per default, and you are now ready to let DSS do all the data crunching.

Once completed it will load the resulting image, and by default saved it as a .TIF file. This is a 32-bit image, it will be large (over 234MB with the Canon 80D RAW files), and not many programs will open it. Luckily the Win10 default photo viewer can preview it. But what is important is that the registering and stacking process has kept as much of the useful data (light photos entering the camera) while removing the random and sensor electronic noise. As we are not done processing the image, no point is throwing out data just yet by using compression or lower dynamic range.


DSS offers capability to adjust the Levels, Luminance and Saturation, but it is best to keeps as is and do this fine adjustment in another program like Photoshop or GIMP.

The next steps will be to continue the processing in other programs:
– IRIS to remove the sky gradient
– GIMP (or Photoshop) to adjust levels, curves and saturation

Continue to Part 3


Lower Orion Constellation

Just when you think you have a good “recipe” to process astronomy images taken with your gear, things don’t quite work out and you end up spending three evenings trying different settings, techniques and steps because you know there’s a better image waiting to be teased out.

M72 and Lower Orion Constellation

M72 and Lower Orion Constellation – Benoit Guertin

The image above (click for a full frame) is as much as I can stretch out from the lower half  of the Orion constellation and nebula with a 20 seconds ISO 800 exposure on 85mm F5.6 Canon lens from my light polluted backyard.

Below is the sky chart of the same area showing the famous Orion Nebula (blue and red box) and the Orion belt with the three bright stars Alnitak, Alnilam and Mintaka.  What is unfortunate is there are lots of interesting deep space nebula structures that glow in the hydrogen-alpha spectral lines of near infra-red, but all photographic cameras have IR filters to cut on the sensor those out.  That is why many modify the cameras to remove the filter, or get dedicated astro-imaging cameras.

Sky Chart - Lower Orion with nebula and open star clusters

Sky Chart – Lower Orion with nebula and open star clusters

Now, back to the main topic of trying to process this wide field image.  I had various issues with getting the background sky uniform, other times the color just disappeared and I was left with essentially a grey nebula; the distinctive red and greenish hue from the hydrogen and oxygen molecules was gone.  And there was the constant hassle of removing noise from the image as I was stretching it a fair bit.  I also had to be careful as I was using different software tools, and each don’t read/write the image files the same way.  And some formats would cause bad re-sampling or clipping, killing the dynamic range.

Below is a single 20 seconds exposure at ISO 800.  The Orion nebula (M72) is just barely visible over the light pollution.


Original image – high light position for 20 seconds exposure

The sky-flog (light pollution) is already half way into the light levels.  Yes, there are also utility lines in the frame.  As these will slightly “move” with every shot as as the equatorial mount tracked I figured I could make them numerically disappear.  More on that later…

Light levels of a 20 second exposure due to light pollution

Light levels of a 20 second exposure due to “sky fog”

The longer you expose, the more light enters the camera and fainter details can be captured.  However when the background level is already causing a peak mid-way, longer exposures won’t give you fainter details; it will simply give you a brighter light-polluted background.  So I needed to go with quantity of exposures to ideally reach at least 30 minutes of exposure time. Therefore programmed for 100 exposures.

Once the 100 exposures completed, I finished with dark, flat and offset frames to help with the processing.  So what were the final steps to reach the above final result?   As mentioned above, I used three different software tools, each for a specific set of tasks: DSS for registration and stacking, IRIS for color calibration and gradient removal and finally GIMP for levels and noise removal.

  1. Load the light, dark, flats and offset images in Deep Sky Stacker (DSS).
  2. Perform registration and stacking.  To get rid of the utility lines as well as any satellite or airplane tracks, the Median Kappa-Sigma method to stack yields the best results.  Essentially anything that falls out of the norm gets replaced with the norm.  So aircraft navigation lights which show up only on one frame of 100 gets replaced with the average of all the other frames.  That also meant the utility lines, which moved at every frame due to the mount tracking, would vanish in the final result.
  3. As my plan is to use IRIS to calibrate colors, where I can select a specific star for the calibration, I set the no background or RGB color calibration for DSS.
  4. The resulting file from DSS is saved in 16-bit TIF format (by default DSS saves in 32-bit, but that can’t be opened by IRIS).  I didn’t play around with the levels or curves in DSS.  That will be dealt later, a bit in IRIS, but mostly in GIMP.
  5. I use IRIS to perform background sky calibration to black by selecting the darkest part of the image and using the “black” command.  This will offset each RGB channel to read ZERO for the portion of the sky I selected.  The reason for this is the next steps work best when a black is truly ZERO.  While IRIS works in 16-bit, it’s actually -32,768 to + 32,768 for each RGB channel.  If your “black” has an intensity of -3404, the color calibration and scaling won’t be good.
  6. The next step requires you to find a yellow Sun-like star to perform color calibration.  As a white piece of paper under direct sunlight is “white”, finding a star with similar spectral color is best.  Sky chart software can help you with that (Carte du Ciel or C2A is what I use).  Once located and selected the “white” command will scale the RGB channels accordingly.
  7. The final step is to remove the remaining sky gradient, so that the background can be uniform.  Below is the image before using the sky gradient removal tool in IRIS.
  8. Image before removal of sky gradient in IRIS

    Image before removal of sky gradient in IRIS

  9. Once the sky gradient is removed, the tasks in IRIS is complete, save the file in BMP format (will be 16-bit)  for the next software: GIMP
  10. The first step in GIMP is to adjust light curves and levels.  This is done before any of the filers or layer techniques is performed.
  11. Then I played around with the saturation and Gaussian blur for noise reduction.  As you don’t always want the transformations to take place on the entire image, using layers is a must.
  12. For the final image above, I created two duplicate layers, where I could play with color saturation, blurring (to remove the background noise) and levels until I got the desired end result.  Masks are very helpful in selecting what portion of the image should be transparent to the other layers.  An example is I wanted a strong blur to blend away the digital image processing noise, but don’t want a final blurry night sky.

Processing RAW Cassini Spacecraft Images

Did you know that you can get access to the latest RAW images from the Cassini spacecraft directly from the NASA and JPL website?  Not only will you have first look at some stunning images of Saturn, the rings and the Moons like this one below from January 16th.  Click the image below for more information from NASA/JPL on that specific photo.

Daphnis making waves - Cassini spacecraft Jan. 16, 2017 - JPL/NASA

Daphnis making waves – Cassini spacecraft Jan. 16, 2017 – JPL/NASA

But you can also download raw images to try your luck at processing.  For this exercise I selected these series of pictures of the strangely perfect hexagonal-shaped storm on Saturn’s north pole.

Downloaded raw image set

Downloaded raw image set

These are images taken with different filters by the wide field camera, and I noted in an Excel file some information on each image, most importantly which filter was used.  Both the narrow and wide CCD on Cassini operate with two filter wheels, hence each image will always list two filters.  For those surprised at the rather “small” 1 mega-pixel camera, keep in mind the spacecraft was launched nearly 20 years ago, and development started in the 1980s.

There is a very detailed document on how to use, calibrate and process the images found at the following link.  But for what I wanted (quick processing) I only needed to find out which filters were the closest to an RGB setup.

Cassini ISS Broadband Filters

Cassini ISS Broadband Filters

Luckily this is well documented, and found them with the BL1, RED and GRN filters.

The image below is a quick addition of those 3 respective images assigned to red, green and blue channels.  The resulting image would be somewhat near the real colours, but I did not take any time to calibrate, hence they are probably a little off…

Saturn with normal RGB assignment (close to real colours)
Saturn with normal RGB assignment (close to real colours)

I also decided to try something that would provide a little more contrast and dive a little into the atmosphere and went with a IR-Red-Blue for RGB assignment by using a one of the narrow-band filters.

Cassini ISS Narrow Band Filters

Cassini ISS Narrow Band Filters

Saturn with IR, Red and Blue for RGB assignment

Saturn with IR, Red and Blue for RGB assignment

Both images above have not be calibrated, stretch or adjusted other than combine the raw images from Cassini.

The NASA/JPL site even has a section for amateurs to submit their photos and host a gallery to see what others have done.

Cassini NASA/JPL site
Cassini Imaging Science Subsystem (ISS) Data User Guide

DeepSkyStacker – Faster and Better Results (updated)

Tried DeepSkyStacker and I think I’ve found a better and faster way of processing my images.

I had been using IRIS for the better part of the last 6 years, and I remember how impress I was at the results compared to the early versions of Registax for deep sky images.  While  IRIS is quite manual and command-line based, it nevertheless got the job done and allowed me to experiment with different methods.  But now, I decided it was time to move on to something a little modern.  I looked at what others were using, and came across DeepSkyStacker.


While IRIS offers a complete package, from image acquisition, pre/post-processing, and analysis tools; DeepSkyStacker only performs the registration and stacking.  But it does so in a faster and more efficient way.  DeepSkyStacker can fully utilise RAM and multi-core processing; hence what took 30 minutes in IRIS is now down to 5 minutes in DeepSkyStacker.

It also automates many steps, and you can even save the process and create batches.  So it’s down to load all your files, and then one click to register and stack.

DeepSkyStacker - Processing Files

DeepSkyStacker – Processing Files

I tried the with some wide field of views I had taken back in September.  And the resulting image appeared to be better.  Now I still have to use IRIS as I like how it can remove the sky background gradient and adjust the colors.  And GIMP is still required for the final adjustments.  So here are the main steps that gave me good results:

  1. Load the light, dark, offsets and flat frames (I had no flats or bias/offsets in my trial run, but that didn’t appear to cause an issue)
  2. Ensure that all pictures are checked and select to Register the checked pictures
  3. For the stacking, I found that selecting RGB Channels Background Calibration provided good color, and used the Kappa-Sigma clipping to remove noise.
  4. After stacking DSS will create an Autosave.tif (32-bit TIFF file).  I need to convert this into another format, but without loose the dynamic range.  My current solution is to use Microsoft Photo Gallery to open and save another copy as JPEG.  Finally did a quick stretching of the RGB levels to ensure better dynamic range when saving to 16-bit TIFF.  16-bit TIFF appears to be the only one that will open correctly in IRIS.
  5. Once in the image loaded in IRIS to remove the background sky gradient.  And then save it in BMP format for import into GIMP.  Yes I know I another file format, so far it’s what I find works best.  GIMP converts FITS and TIFF to 8-bit, causing incorrect color depth.
  6. Final adjustments with levels, light curves, saturation, noise filtering, etc.. is done in GIMP.

Now for a little more playing around, and trying it on some on my older pictures.

DeepSkyStacker saves files in 32-bit TIFF by default.  After stacking many images the dynamic range is quite large, and this is not data we want to loose.  But the problem was finding a program that was able to correctly handle the 32-bit file format.  The next release of GIMP (version 2.10) will handle 32-bit files, but GIMP 2.8 was limited to 16-bit and even there it would convert the image to 8-bit for manipulation (GIMP 2.9.2 and up might work, but needs to be compiles on your computer – development package).  Not good…  Before downloading yet another photo imaging software I tried some of my current programs and found that the  Microsoft Photo Gallery software for Windows 10 does a great job of handling the 32-bit TIFF files.  Once the image opened, under File – Make a Copy I save a version in JPEG.  Yes I know not ideal, but I avoid a lot of the quantization conversion error and I’m able to continue my processing in IRIS and GIMP.


Layers and Blurring


We spend lots of money on expensive optics and hours trying to get the focus spot-on or the mount alignment/guiding perfect for smooth tracking to avoid blurry and stretched stars.  So why would you want to blur your final image?

Consider the images below.  The one of the left is softer and more pleasing to the eyes, yet the stars remained sharp.


Side-by-side compare of blurred and the original image

One way to obtain this effect is by creating copies of the image, applying varying blur to each and then adding them from heaviest to the least blur using the Lighten only layer mode.

Take your original image and duplicate as required (in my example I blurred two layers, hence need a total of three identical layers).


Original image (centered on Constellation Vulpecula)

Apply heavy blur to the bottom layer.  At the same time, reduce the color saturation and adjust the levels to get nice blacks.  You want the blacks to be nice and dark such that the general shape of the cloud-like structures appear due to the bright and dark zones.  In this example, the blur was applied to a level of 80 pixels.


Heavy blur to the bottom layer, and reduced color saturation

Repeat the same for the middle layer, but with less blur (level of 20 pixels).  If you want the colors of the stars to pop out, increase the color saturation.  It will create an effect of nebulosity around bright stars.  Once again, adjust the levels as required.


Medium blur to create nebulosity effect

Finally, the top layer don’t apply any blur, adjust the curves to reduce the faint portion of the image as you don’t need to keep this portion of the image.  You only want to keep the nice bright stars.  The dim structures are kept in the lower two blurred layers.

Adjust the % between the layers to get the desired effects  The pixel intensity from bottom (most blurred) to the top will be kept only if the result is brighter than the previous layer.  The sharp and bright stars are from the top layer, while the overall dim structures are from the blurred lower layers.


Final result after blending the 3 layers

Turn the various layers on/off to see what is the contribution of each.  It’s a lot of trial and error depending what you accentuate versus what you want to fade into the background.  Play with the level of blur, the curves and the % layer blending until you get the effect you desire.

For more information on the original image, see my post on Vulpecula.

Composition with Landscape

I’ve mentioned it before that you don’t need a fancy telescope and tracking equatorial mount to get into astrophotography.  Simply a camera on a tripod with a short focal lens can do wonders, especially with the high ISO settings in new cameras. A single 10 seconds exposition can reveal lots of stars, however to capture more photons a longer exposure is not better as the stars will become streaks.  But one can easily improve the image and get better signal/noise ratio by stacking multiple images.

However, there is one drawback to stacking multiple exposures if you decide to also capture the landscape: Earth rotates, therefore the sky moves while the landscape stays still.  If you align the images using the stars, then the landscape becomes a blur.  Not the end result that we want.  Luckily a quick composition with two layers and a mask solves everything.

Below is a single 10 seconds exposure at ISO 800 with a 17mm F4 lens; you have the landscape with city lights and the stars above.  Yes that is Orion…

Single 10sec exposure (ISO 800)

Single 10sec exposure (ISO 800)

In order to improve my signal, I worked with IRIS to align and stack 5 frames, this reveals many more stars, but also amplified the light pollution.

Aligning and stacking 5 images. More stars appear.

Aligning and stacking 5 images. More stars appear.

Luckily within IRIS there is a function to remove sky gradient.  The algorithm takes a series of sample points and attempts to make the sky uniform.  Not bad, the images are not a hopeless case.

Removing the sky gradient with IRIS

Removing the sky gradient with IRIS

As mentioned above, the alignment was performed with the stars, hence the background is now blurring.  Below is a close-up.

But when aligning on stars, the landscape blurs.

But when aligning on stars, the landscape blurs.

That is just 5 images, stack a much larger quantity or with more time between frames and it will only get worse.  It becomes pointless to shoot with the landscape if the end result is blurry.  Luckily working with layers in a photo editor can easily solve the issue.  We want to keep the stars from the stacked image, but the landscape from a single frame.  Follow these easy steps:

  1. Load into your base layer one of you single frames.  This is what will be used for the landscape.
  2. Load into a new layer your stacked image.  As your stacked image contains more and brighter stars select to Lighten Only instead of normally adding both layers.  You can play with the brightness of the stacked layer, and/or darken the base layer to get the desired blending.
  3. Create a mask to the stacked layer such that the blurred landscape is not permitted to show through.  See image below, I simply grabbed the airbrush and blackened the landscape area in the mask such that it will not show through the layer.  Note that the I only edited the mask, not the image itself.
Creating a mask for my layer: white is transparent, black will block

Creating a mask for my layer: white is transparent, black will block

The end result, is improved image of the sky, and a landscape that is still sharp.

Both layers added with the mask

Both layers added with the mask

Below is a comparison the composition with stack and layer (left) and a single shot (right).  We are able to achieve both of our goals of getting more stars (more signal) while keeping the landscape from becoming a blur.

Comparing the composition with layers (left) and single shot (right)

Comparing the composition with layers (left) and single shot (right)

And why not take some time to identify some key features in the image.

Constellations Orion and Taurus above the landscape.

Constellations Orion and Taurus above the landscape. (Click to open)