Let’s demystify an image format that gives you fits.
Yes, that’s a bad pun; no, I don’t care.
The FITS file format is the most commonly used file format for astronomical data (astro photos!). It’s also not natively readable by the most common photo editing software suites, which seems like a problem to the beginner, and a bit annoying for advanced astrophotographers. So, let’s talk about FITS, baby. Why do we use it, and how can you convert it to something your normal image processing application can understand? I’m in a funny mood while writing this, I hope it makes a dry topic a little more entertaining.
The current standard as of this article was defined and finalized in 2008, FITS version 3.0, and it’s used for all kinds of scientific data. FITS is not just an image format! Although, images are what is stored most often in these types of files, you can perceivably store anything you want in a FITS file. Data is data.
What does FITS stand for? (…other than truth and justice for all)
FFlexible: FITS is stretchy, it does whatever you want it to do.
IImage: It’s for images…but not just for images.
TTransport: It’s a container for whatever you want, like image data.
SSystem: I think they added a fourth letter to make it a naughty word. Or, it’s not just a file. You pick.
OK, cool. But what is it…
Think of FITS as a document, a very accurate written description of an image or other data. One of the really cool things about FITS files is also the fact that there is an ASCII (human-readable) file header (the first few bytes of the file) that can contain pretty much whatever you want.
Want to tell us what camera, temperature, wind speed, GPS coordinates, astronomical coordinates, height, weight, eye color, and middle name of the photographer, or virtually any other fact about the data contained there is to know? Done. FITS can handle that.
The actual image pixel data itself is stored in a 1D, 2D, or 3D multi-dimensional array, and it isn’t compressed. The files are big, but the data is very accurate.
Why do we use FITS instead of camera raw?
Guess what: camera raw files (CR2, NEF, etc.) are compressed! Booooo. But that’s not the only reason FITS files are cooler.
Versioning: it’s backward compatible
One of the reasons it was created in the first place was for archival purposes. The standard used for FITS is important, because each newer version has a mandate to support all older versions. That’s cool.
If I had a dollar for every time I was annoyed about a new “better” version of a file format required by a software update that broke backward compatibility, there wouldn’t be ads on this website and I’d own a small island with no outdoor lights allowed after 8pm within a 500km radius and you’d all want to live there.
In my opinion, it’s also pretty cool to use an image format that supports ANYTHING you throw at it. For example, while Photoshop will support 8-bit and 16-bit TIFF images (and maybe 32-bit now?), I’ve used astronomical image processing applications that will support FITS data up to 64-bits per pixel (BPP), and maybe even higher!
FITS can handle it because there is no real theoretical limit. It just stores a bigger chunk of data for each pixel as you increase the BPP. And if we’ve learned anything so far about why we shoot raw (ALWAYS!), we know that a higher BPP is good stuff for those faint cosmic details. Yes, the file sizes dramatically increase, but so what, space is cheap (…another bad pun).
Low constrast detail 8-bit < 16-bit < 32-bit < 64-bit < 128-bit < N-bit High contrast detail
Some may argue that it’s silly to use any BPP higher than what the camera shoots, and while that is true for the original raw image data, it loses face as soon as we start to manipulate it with post-processing software. While there surely is a BPP limit that our weak human eyes can discern, when teasing out the faintest details with some local contrast, the more the merrier. So, bring it on and use the highest quality image format your CPU can handle without releasing the magic smoke that makes it go.
How to use FITS image files
The problem: your favorite image processing application doesn’t natively support the super-cool FITS images you’ve downloaded from [our website, your friend, Hubble, NASA, aliens].
The solution: The ESO/ESA/NASA FITS Liberator software package!
Because they are super nice, the folks at Hubble distribute, for free, a nice little app to help you view and convert FITS images into more “normal” readable formats, like TIFF. It works on Windows and Mac OSX, but takes a little bit of dinging around to get it installed in the newest OSX versions, it seems.
Also, thanks to Twitter follower @AstroFaris for reminding me that there is another option for Mac OSX users: FITS Preview by Cloudmakers.
However, you’re better off, if you can, using FITS images natively in applications like PixInsight, which is now also using a newer open data format called XSIF (that we aren’t going to talk about right now).
How do you know you can trust me?
So, if you want, read more information about FITS and its history and usage on Wikipedia and the official NASA site.
How do you open fits files that don’t necessarily contain images? For example, I’m trying to read the fits files from Chandra, but they are all rejected by fits liberator (fits files from other telescopes like Hubble work fine). Do you know why fits liberator would say “file not supported” for fits files from Chandra?
I haven’t worked with Chandra FITS files myself, so I can’t say for sure, but it looks like you may need to use OpenFITS to decode Chandra data. See here: http://chandra.harvard.edu/photo/openFITS/overview.html
Please let me know if that helped you!
Thanks Cory! I figured it out. The software required to view the Chandra fits images is SAOImage DS9. It allows the user to zoom into the x-ray image with sub-arcsecond precision, and even export in jpg, png, or tiff. Non-image fits files are accessed from within the software by accessing header data.
Great stuff — thanks for getting back to me. This will surely help others as well!
Is FITS used only for single images or can it be used with stacking images? David
The NASA tool “FITS Liberator” doesn’t run on macOS 11 (Big Sur).
I would like to hunt for near-earth asteroids and report them to the MPC. As far I can tell most software for that purpose only uses FITS. I’ve seen some downloads available that convert RAW formats to FITS. Would those images converted to FITS be acceptable for programs like ASTROMETRICA, etc.?
How to extract the pulsar contour, such as how to extract the pulse contour of pulsar，thank you, master。
Cool site well done. A quick question what software can I use to convert my Fuji Raw files into Fit files on my Mac? Many thanks Mick