Converting FITS Images and Curta Build Manual Progress

Curta Build Manual Progress

I have been pretty busy building out a second Curta. There are multiple reasons for building a second one in order to write up a build manual. One is that I have the required work fresh in my memory as I go so I don't forget things. Another is to ensure that my work is reproducible. I'm even using a different 3D printer (a D-Bot) to print the parts.

Currently I have all of the parts printed and I am working through manually fitting and assembling the parts. I have been documenting every step of the way with loads of photographs. In fact, I set up my DSLR with my computer to take photos at a 5 second interval as I work. Many of the photos will be trash, but I should have plenty of images of every step.

I should be ready to be ready to start collecting, categorizing, and curating those images into a build manual in a few weeks. I have a self-imposed deadline for getting the second Curta working before the end of the month (and hopefully a good portion of the way to being fully painted with letters and numbers) -- more on that in a future post. Whether I make that deadline or not, I will be working on the build manual after that date passes.

Converting FITS Images

There are a lot of programs out there to take a sequence of images using a DSLR camera on an interval and save them to your computer. Unfortunately I was unable to get most of them to work well. I ended up settling on a program called AstroDSLR which is designed for astrophotography. The con to that decision was that it records images in FITS format which needs conversion to a more common image format for things like posting to this blog.

FITS images are recorded by AstroDSLR as three grayscale images wrapped up in the FITS file format. Each image represents the red, green, and blue channels from the original photograph as recorded by the camera. The problem I had was how to convert that FITS image to a Jpeg image while re-encoding the individual images into RGB channels.

I began by using ImageMagick's command-line tools. My initial attempt at conversion looked like this:
// Comment
$ convert Curta_0s_001.fits Curta_0s_001.jpg
$ ls Curta_0s_001*
Curta_0s_001-0.jpg Curta_0s_001-1.jpg Curta_0s_001-2.jpg Curta_0s_001.fits

That did not produce what I desired. Each of those jpg files is a greyscale representation of the red, green, and blue channels in the image.

I did a lot of searching and couldn't find an answer to the question. I knew ImageMagick could do it (it has a TON of features): I just wasn't sure how. I was just about to post on the ImageMagick forums when I decided to first consult the convert tool's help. I found that it supports an option called "-combine". That sounded like it would do the trick, but I wasn't sure. The description just said, "combine a sequence of images." I did have a sequence of images, but I need to also specify that each one represents one of the red, green and blue channels. After a bit more looking I found the "-channel" option which selects image channels.

I then whipped up the following command:

$ convert Curta_0s_001.fits -channel RGB -combine Curta_0s_001.jpg
$ ls Curta_0s_001*
Curta_0s_001.jpg Curta_0s_001.fits

That produced a single color Jpeg with the RGB channels combined! However for me the image was upside down so I just needed to flip it:

$ convert Curta_0s_001.fits -channel RGB -combine -flip Curta_0s_001.jpg

Voila, I have a perfectly good Jpeg! I'm sharing this now that I have a solution so hopefully the next person who needs to do this can find it.


Popular Posts