Astrophotography for Dummies and How to Stack Photos Without Background Noise

Well, not too much background noise at least!

I love photos, and I’m beginning to get into astrophotos as well. One issue I face is how to get long exposures from the sky when you have light noise. I want to see arcs in the sky, but the longer you expose, the brighter the background becomes. The same problem occurs if you are using a polar tracker, you get more light, but also more noise!

So I decided to get a small script together to generate images like this one:

58 stacked photos
58 stacked photos, all captured for 20s on a Canon R6 + 28-70 at 28mm/f2

It feels a little bit artificial because the noise is minimal and because there are not that many small stars, but it’s a good start. The script is very easy, it just reads all images from the command line pattern, and then gets the maximum pixel value for all pixels across these images. Saving in “result.jpg”, and this is it!

# -*- coding: utf-8 -*-
import glob
import sys
import numpy as np
from PIL import Image
def readFiles(images):
loaded = [np.asarray(Image.open(img)) for img in images]
return np.array(loaded)
if __name__ == "__main__":
r = np.max(readFiles(glob.glob(sys.argv[1])), axis=0)
Image.fromarray(r).save("result.jpg")
view raw astro.py hosted with ❤ by GitHub

The script doesn’t try to align images at all, as we want to see the arcs (at least I want to!), so to use this script, you need to capture many images on a tripod and a remote control.

Anyway, easy, there may be other small scripts like this in the future, who knows.

Buy Me a Coffee!
Other Amount:
Your Email Address:
Series NavigationHow to Efficiently Stacking Multiple Astrophotographies >>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.