How to Photograph Star Trails on a Budget

This past April, I decided to try and become more engaged with the astronomy community on Instagram by participating in #internationaldarkskyweek. #IDSW2021, as I began to refer to it as soon as I figured out that the abbreviated hashtag existed, would come to test my ability to make Instagram posts. It would also reintroduce me to an aspect of astronomy and science-communication (sci-comm) that I had really missed.

My first post for International Dark Sky Week.

The first day of IDSW was off to an unfortunate start. The clouds had rolled in and there was little to be seen or done about that. I had originally planned to take out my telescope for the first time in several years, but quickly pivoted when the threat of rain seemed imminent. Unsure of what to do for content, I thought back on what we had done for astro labs that didn’t involve observing, as well as what I had done in my own courses.

I soon realized this was the perfect opportunity to talk about planning observations. I spent a fair bit of time talking about about finding the best nights and understanding the amazing charts provided by cleardarksky.com

The Clear Dark Sky Chart for the Blackfoot area.

These charts and planning could be an article on their own — and likely will be — but today I want to talk about another aspect of amateur astronomy that observation planning reminded me of: Star trails.

Star trails are captured by taking a series of long exposure images of the same part of the sky over several hours. The motion of the earth around its axis results in the stars appearing to move over the course of the evening. The motion is actually quite significant, about 15 degrees per hour (your fist held up at arms length covers a span of about 10 degrees, for reference), so star trails can be captured with only a couple of hours of time spent actually exposing the images.

My first night of capturing star trails. The animation was produced by creating successive frames of stacked images so that the trails appear to grow over time. The gaps in the trails are due to camera response time.

What follows is the process I used to create the above animation, along with some still images. This is hardly an authoritative piece — I am still figuring all this out — but I hope this provides some background for people looking to get into the hobby and who may not have the funds to purchase high-end equipment.

Step 1: The Camera Setup

There are a lot of different methods for capturing star trails. The method that is used depends a lot on the specifics of the camera involved. The tool of most professional astrophotographers is the DSLR camera with its swappable lenses and large higher end sensor.

The camera I used for the project. It is a Canon PowerShot SX160 IS, but any camera with a tripod mount point and a manual mode should work for our purposes.

My partner had kindly offered me the use of hers for the project. I also had the option of using an action camera I had received for Christmas. GoPro has a great piece on astrophotography using action cameras, so I point you to that if you are interested. I also point you to that for more background from professionals in the photography industry. Ultimately, I was curious to see what could be done with an old digital camera I had found in my parents’ basement while gathering some other supplies. I figure a lot of folks have that old camera boxed up somewhere now that the phone camera has really usurped the role of the point-and-shoot and thought they might be interested in giving it a new and interesting purpose.

The next thing I needed was a way to hold the camera steady. I did not own a tripod, but I did have the mount for an IKEA wall mount makeup mirror that had a screw base. The closest thing I can find on the website is the FRAECK for $9.99 at the time of writing. This is not a required purchase. It would be just as easy to buy a cheaper tripod for a similar price, but the goal was to illustrate what could be done with items that were on hand

The FRAECK Mirror from IKEA

(actually, I was really excited to give this a try, and didn’t want to wait for a tripod to show up, so I stole this from the overhead camera mount I had rigged for my workbench…). There is no particular reason the mirror base should have the right threading for the camera mount point, and so this mirror might not work for everyone, but I can attest to it working for this particular camera. I used some clamps I had to secure the mount to a deck railing, but it could easily be screwed into a board and used to create a homemade tripod from some wood if the reader is so inclined. It can also be mounted somewhere more permanently if there is a desire to capture the same patch of sky each night (this is one way to capture the Analemma of the sun or the motion of the planets). The clamps used are not particularly important, I would recommend something with rubber or plastic jaws as metal ones can damage softer deck railings made from wood or vinyl.

The camera setup. The sum total of this assuming you own the camera is about 20 dollars. Any clamps can be used, and the stand is from an old IKEA mirror.

From there, the next big hurdle was understanding the idiosyncrasies of the camera. The Canon PowerShot has a a shutter speed that can be set to 15 seconds without modifying the firmware. The shutter speed dictates how long the camera is actually taking in light. For star trails, we will want to set the camera to this maximum value. The camera also comes with a continuous shooting mode that will continue capturing photos indefinitely. The main problem is that continuous shooting only works for as along as the shutter button on the camera is held down. Now for Canon cameras, there are ways around this using the Canon Hack Development kit (CHDK) that we will discuss in the optional section at the end, but the way I dealt with it initially was with a second clamp that held the shutter down. Ultimately, the limiting factor for my observing sessions was the camera’s battery. The SX160 uses standard AA batteries, which are convenient, but they are also limited. Using disposable batteries also means the camera has no way to power it from an external source without physically modifying the camera. Other options with rechargeable batteries may offer more utility in this regard.

One important thing to consider is where to aim the camera. You’ll want to avoid large obstructions such as buildings or trees, and try to shield the camera from external light sources. That was a problem for me, living in a fairly urban area, and you can see the taillights of cars in some of the frames as they entered the lot behind our apartment. For star trails, aiming toward the north will give more interesting results.

The area around the north star. The equatorial grid gives a rough idea of the size of star trails expected in this region. Image from Stellarium Planetarium Software. Also, featured: Camelopardalis — the giraffe — my favorite constellation.

Stars near the north star, Polaris, will move in much tighter arcs around the celestial pole, with circumpolar stars completing a large fraction of a full circle during the night. If you are looking to shoot planetary motion or solar motion, you will be aiming closer to the celestial equator or the ecliptic plane. This plane is located about 90 degrees from the north star and will move with latitude. For us in the Northeast, it is about 50 degrees above the horizon or about halfway between the ground and the point directly overhead when looking south. This area is not quite as interesting for star trails as the stars appear to move largely in straight lines. Shooting in the winter will also yield more hours of darkness, meaning longer sessions provided camera power can be supplied.

Step 2: Dealing with The Photographs

My workflow for processing photos involves using purely open-source software. The RAW images are processed with nUFRAW (laptop screen), and the final product is produced using The GNU Image Manipulation Program (GIMP, main screen). Coffee and water are also an important part of the process.

Following a fun night of observing and photographing the night sky, you will have a memory card full of photographs. These need to be processed and edited in order to produce the final images of star trails we are aiming for. Plenty of commercial software exists for editing the photos and for dealing with RAW images (more on those in a minute), but I again wanted to focus on software that is freely available to anyone with a computer.

The main software we will be working with is the GNU Image Manipulation Program (GIMP). GIMP has many of the same features as commercial software like Photoshop, but is available for free as a cross-platform binary as well as from source. There are some idiosyncrasies that come with the program, but it certainly makes up for that with the cost. The first thing we will do is open the images as layers in GIMP.

The File menu in GIMP

To do this we:

  1. Open GIMP
  2. Create a new document
  3. go to File -> Open as Layers

Once we have all the images loaded as layers, we will end up with the image of the top layer on the screen. The instinct to make the other layers visible is likely to play with opacity of the upper images in order for the lower images to show through (This is certainly possible, but requires a fair bit of math to get the changes in opacity correct. Each subsequent layer needing to be more transparent in order for all the stars to appear the same). My first attempt at producing star trails used the opacity setting, and resulted in star trails that seemed to quickly fade. It was certainly a cool effect, but not what I was looking for.

My first try using the opacity settings. The results are a cool meteor effect, but not quite what we are looking for.

After doing a bit more research, I learned that there were multiple layering modes available to the user at the top of the layer sidebar. The default is for fully opaque layers to be stacked on each other and treated as independent images (Normal) but another layering method, called Lighten only, takes the stacked images and adds pixel values from lower layers to higher layers only if the result means that the final pixel values will be brighter than in the top layer.

The layers menu in GIMP. The mode selection is at the top and is set for each layer individually.

Effectively, what this means is that the stars in each layer will be visible in all upper layers while the background will remain relatively constant. As an optional step, GIMP does allow the user to modify the final image using filters and by controlling things such as the brightness, the black point, etc. I opted to export the image and do any touch-up on my phone, but the option is definitely there to use GIMP or another desktop program such as darktable. When we are satisfied, we can export the image from the file window. I chose to export it as a .png because this format gives a good balance of quality and file size.

The final product in GIMP

Step 2.1: Generating Animations (Optional)

Now that we have the images incorporated into GIMP, we can also generate an animated gif of the stellar motion. To do this we do the following:

The filters menu

1. Import all images as layers

2. Go to Filter -> Animation -> Optimize (for GIF)

After optimization we can then go to

3. Filter ->Animation -> Playback…

to test how animation playback looks. What you will notice is that the animation looks more like a timelapse using this method, with the images behaving normally instead of with the Lighten Only layering mode applied. If this is what you are looking for in an animation, then you are good to go and you can export the image as an animated gif with the settings you chose in the playback menu. If, however, you are looking to animate the star trails as above, we need to do some additional work.

An animation using the above process. I had to upload it as a Youtube video because the .gif file that generated this video was massive.

To make an animation like the one above, we first have to generate the frames. This requires creating a new file with the oldest image as the first layer. We can then open the next image as a new layer, and set the images to Ligthen Only mode. We will then export this image as Frame1.png, before opening the next image as a new layer and exporting the combination of the three images as Frame2.png, and so on until we have loaded every image and exported the resulting frame. We can then create a new GIMP file and load all of the frames as layers, being sure to load the oldest image as our first frame or else the animation will start with two stars as opposed to one. With these new layers, we can then follow the same steps to produce the animation as for the first animation, but now the star trails will appear to be drawn on the sky as the stars move.

One final step we can take for our animation is to convert it to an mp4 file using ffmpeg. This produces a video that is often smaller than the gif file, and can be uploaded to sites like Instagram. If you use an Apple device, you will need to set certain parameters to get the video into a format that the device will be comfortable using.

FFMPEG settings that should be compatible with Apple devices. This example involves an mp4 file, but the same command structure will work with a .gif as well.

I have included an example with the settings I have used, but I make no guarantees. Luckily, if you have a device that can use Quicktime player, you can always re-export the video with Quicktime and that will put it into a format Apple devices can use (I do not currently have such a device, but any Windows or MacOS user should be fine).

Step 2.2: Using RAW Images (Optional)

I am not a professional photographer, or even a particularly competent amateur when it comes to things such as image formats, but I do understand the basics. By default, most cameras produce a jpeg image that is processed by the camera. These are usually fine for most applications but if you want more control over what the final image looks like the camera will often allow you to output the raw image file known as a RAW. GIMP can deal with RAW images, given the correct plugins, but it is often better to pre-process the images. Again, there are many programs including darktable mentioned above, but I chose to use nUFRAW, which is an updated version of the GNU UFRAW software.

The nUFRAW GUI window

It is simple to use and I like it because you can create an image template and then batch run processing using the command line by first creating a nufraw file in the GUI for one image from the set.

The batch command for the Linux command line.

Final Thoughts

This was a really fun project, and I am hoping to dive into star trails in a lot more detail as time allows. The next step is to head to a darker area where I can focus more on the polar region and get those tight spirals I had mentioned before. Shooting planetary trails would also be exciting, but the fickle New England spring will mean waiting on those for a little while. In the end, a lot was accomplished using only odds and ends combined with free software, and I highly recommend anyone interested give this a try.

The final image of the star trails. The red glow on the wire and in the trees are from a car leaving the lot behind the apartment during the final frames.

Addendum: Using CHDK

I will not explain this in detail because I do not feel qualified, but I wanted to make the reader aware of the Canon Hack Development Kit. I installed the modified CHDK firmware on the camera following this tutorial. I took advantage of three features of CHDK to produce this final image.

The first was the exposure override option, which allowed me to take a 40 second exposure as opposed to a 15 second one. This actually did not change the result appreciably, save for the fact that dimmer stars were not visible in the 15 second exposure.

The second was the fact that I used the dark frame option to remove noise. A dark frame is an exposure with the shutter closed to understand thermal and electrical noise in the sensor. This did actually help, but is also the reason for the noticeable gaps in the star trails as it took a dark frame after each image.

The third was that I installed a CHDK script to take continuous images. I did not actually use the script for the main image, but I did use it during the video that included the clouds. The script is more convenient but it does come with a larger power draw so the camera did not last as long as with the default continuous shooting mode. CHDK scripts are fairly easy to read and are written in a version of BASIC, so anyone interested can start with a modest learning curve.

Just some guy trying to be an astrophysicist. GWU PhD candidate, Chandra X-ray Center Predoc, Stellar Undertaker, Maker of things.