FITS for the web

[This is a cross-posting from my work blog]

If you've ever used a telescope with a CCD camera you've probably encountered FITS files. FITS, or Flexible Image Transport System, is a file format used widely in astronomy to share images.

As an astronomy student I remember finding FITS files a little mysterious. Their large file sizes made them seem antiquated compared to JPEG and PNG image formats but they do have some advantages: they store useful astronomical information about your observation (e.g. coordinates on the sky, details about the instrument, observer etc); they have a larger dynamic range (PDF link); and they can store more than just images*.

A few years ago, whilst testing some astronomical radiometers, I had to work out how to output time-series data in FITS format from a C program. It was a steep learning curve for someone who had never processed binary data with code. A week or so ago I was talking to Jon Yardley about how good it would be to be able to work with FITS files in a web browser. Web browser manufacturers don't support FITS files but during the conversation I realised that I had the tools to do it without the need for extra browser plugins.

Last year I experimented with reading astronomy visualisation metadata (AVM) from JPEGs. That made use of Jacob Seidelin's Javascript library for reading binary files and lets you read them byte by byte. More recently I've learnt how to draw in the browser using HTML5's <canvas>. The result is that I can now display a FITS file in a web page. The code is available if you want to have a play with it. It is a bit slow but that is mostly due to the time it takes to transfer a 2.2 MB FITS file over the internet; processing and drawing the image is actually pretty quick (tested in Firefox 4 beta). It even works on my Android phone!

Last night I thought about completing the circle; to save a FITS file as a JPEG image with AVM headers created from the FITS file headers. I couldn't see that it was possible to attach EXIF tags to a <canvas> element (although the canvas element can be saved as a PNG in Firefox 4 beta) but I discovered that somebody has written a library to encode JPEGs with Javascript. Over the next few days (or weeks) I'll look into that library and see if it will provide the solution.

I realise that specific software exists to process FITS files and ESA/ESO/NASA's FITS Liberator makes it possible for those with Photoshop. However, these have always been slightly detached from the web itself and require separate software to run. Web browsers are increasingly ubiquitous and increasingly capable (yes, even Internet Explorer) so finally FITS files can start to get out onto the web proper.

* They can hold tables as well as data cubes with up to 999 dimensions!

Posted in astro blog by Stuart on Tuesday 22nd Feb 2011 (10:59 GMT) | 1 Comment | Permalink

Comments: FITS for the web

Hey I know this is not the right spot to post this but tonight I was looking up at the sky and I seen this light that looked like a comet but it was red. Then the tail disapeared and it just keept going as i keept looking at it, it looked like it was coming down to eath as it hit the atmosphere the light disapeared completely then it came back then it was gone. does any one know anything? or can help me figure out what that was?? i would really appreciate it. I live in Baldwin park, California.

Posted by Alejandro Martinez on Friday 15th Apr 2011 (04:57 UTC)

ADD A COMMENT:


Don't provide an email/URL unless really necessary as your comment may get caught in the spam filter. No URLs get turned into links so don't bother. The ground rules for commenting are:
  1. No profanity or personal attacks please. Keep it clean.
  2. Restrict comments to subjects relevant to the post.
  3. Don't mention Pluto. If you do it'll be replaced by Goofy.
  4. No spam i.e. anything commercial unrelated to astronomy.
  5. If you think you've discovered a Theory of Everything, a replacement to Relativity, or something similar then please publish it in a journal rather than in my comments.
Comments against the spirit of these ground rules may be removed.











* required fields