Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.


RAW to FITS batch converter for Linux

Recommended Posts

This is my first post here and I wish to introduce a little program i wrote.
This is a RAW to FITS batch converter. Converter supports many cameras vendors: Canon, Nikon, Pentax, Fuji, Konica, Hasselblad and so on.
May be useful for someone who shooting space with DSLR and wanna do a real science, search for variable stars for example.

Program is very simple (see attached screenshot), you just set input directory, output directory and few conversion options.

You can choose how to process color channels from the RAW file.
Possible options is:
- convert RGB to avarage grayscale
- store all three channels as separate images in a one FITS.
- store all three channels in a separate FITS's
- store only one selected channel

Converter supports multithreading conversion, depending on your cpu/cores count.

All data you entered in UI will store in FITS header. Some data (like exposure, date and camera model) may be acquired from the RAW file, this is preferable.


This is a free software licensed under GPLv2 license.

You can get it on github: https://github.com/olegkutkov/Raw2Fits

Program uses libraw library and i highly recommend to get latest stable version of this library instead of using your distro version. If you have multiple LibRaw versions on your system - please carefully check which version you linking and using in runtime. Correct Makefile if needed.

Libraw version older than 0.17 may not correctly extract EXIF data from the RAW files.

Also you will need cfitsio, any version is Ok.

User interface is built with GTK3 toolkit and tested with Gnome 3, Mate and Cinnamon DE on different Mint, Debian and Fedora distributions.


After executing 'sudo make install' command this program should appear in your Applications menu :)

Hope this program will be useful for someone.
I will be glad to hear your feedback, propositions and bug reports :)

raw2fits window.png

ofiginal raw.png



fits header.png

Edited by OlegKutkov
  • Like 3

Share this post

Link to post
Share on other sites

Few updates.
New input fields in UI for RA and DEC of the observed object.
FITS header was reworked, now it's mostly corresponds to standard, more fields was added. Now it contains object coordinates in h:m:s and coordinates of the image central point which acts like a reference point.

In future version will be added communication with astrometry.net service so all generated FITS's will contain full astrometry information.

Also console version is under development and will be released soon. This version works with configuration file and it's more flexible.



  • Like 1

Share this post

Link to post
Share on other sites

If only I could get Ubuntu to run on my 2006 MacBook I would like to give your software a go - it looks very interesting.

Back to the MacBook :(


Share this post

Link to post
Share on other sites

Hello and thanks for feedbacks.

Today i released a new version 0.4.1.
Now with console variant!

Project adress is the same: https://github.com/olegkutkov/Raw2Fits
To build console version just type "make cli"
You will need few dependecies:
 libraw (same requirements, newer versions is better)

Console program requires a simple configuration file.
Here is example:

 raw2fits-cli sample configuration file
 Oleg Kutkov <elenbert@gmail.com>
 Crimean astrophysical observatory, 2017

    /* input/output params */
        raw_dir = "/media_storage/sampleraw";        // Directory with RAW files to convert
        fits_dir = "/media_storage/fitsout";        // Where to store FITS files

                File naming mode, available options are:
                    0 - <RAW file name>.fits
                    1 - <object>_<datetime>.fits
                    2 - <object>_<filter>_<datetime>.fits
                    3 - <RAW file name>_<datetime>.fits
            mode = 0;

            /* Overwrite already existing FITS */
            overwrite = false;

    /*  Fits header params
        you can leave fields blank, or comment it or even remove
        such fields just will not be included in the target files
        object = "Antares";        // Observed object name, max: 71 symbols
        object_coordinates = {
                                ra = "16:29:24.45970";    // Observed object coordinates RA
                                dec = "-26:25:55.2094"; // Observer object coordinates DEC

        /* Telescope name */
        telescope = "Newton";

        /* Clear aperture of the telescope in meters */
        teleaper = 0.15;

        /* Focal length of the telescope in meters */
        telefoc = 0.75;

        /* instrement name, leave blank or comment to use camer model from RAW file */
        instrument = "";

        /* observatory name */
        observatory = "CrAO";

        /* Observatory site name */
        sitename = "Crimea, Nauchniy";

        /* Latitude of the observing site, in decimal degrees  */
        sitelat = 44.7297;

        /* East longitude of the observing site, in decimal degrees  */
        sitelon = 34.0125;

        /* Elevation of the observatory site in meters */
        sitelev = 610.0;

        /* Observer name, leave blank or comment to use camer model from RAW (if present in) file */
        observer = "Kutkov";

        /* Filter used in observation, set "C" if no filters were used */
        filter = "C";            

        /* Observation date, correct value in FITS standard, leave blank or comment to use value from RAW file */
        #date = "2017-09-24T02:04:33";

        /* Exposure of the single image in seconds, leave blank or comment to use value from RAW file */
        #exposure = 28.1;

        /* Temperature during observation, Celsius, optional field */
        temperature = -4.7;

        /* Additional notes, free form text */
        notes = "Clear, Moon"

    /* Image & colors processing options */
            Color channels mode, available options are:
                0 - Convert RGB to average grayscale
                1 - R, G and B channels to the separate FITS's
                2 - R, G and B channels to the one FITS with separate headers
                3 - Only R channel
                4 - Only G channel
                5 - Only B channel
        mode = 0;

        /* Apply autobright by histogram */
        autobright = false;

        /* Apply pixels interpolation */
        interpolation = true;

        /* Apply pixels autoscale */
        autoscale = true;


As you can see configuration file is more flexible and supports more fields for FITS header.

Program launch is simple: raw2fits -c file.config

You can override input and output directories with -i and -o arguments correspondingly.

Amount of messages during conversion may be reduced with -q argument



Share this post

Link to post
Share on other sites

I have Raw2Fits running under Ubuntu Astronomy within VirtualBox on a NUC-PC (I gave up with the MacBook!).

This is a really steep learning curve for a non-Linux person. I have tried the current version and it worked perfectly on my Canon raw files, converting them to individual RGB .fit files.

Thank you.


Share this post

Link to post
Share on other sites

Thank you!

I believe it's possible to build native version of my program for OS X. Everything that i need is actually OS X. Maybe i will try to play with Virtual machines or with Hackintosh.
Can you specify your OS X version?

Share this post

Link to post
Share on other sites

Hi Oleg,


This is the version I use - running on a 2013 MacBook Pro.

My programming experience is very dated - 6502 processors on home computers, IBM8080 and Fortran IV on ICL1900 mainframes - all way back in the 1970's and 80's. Since then I've been a GUI 'wrapped in cottonwool' user I'm afraid.

I am currently trying to get to grips with Linux (via VirtualBox on the NUC) and programming an Arduino (via the MBP) and at my age it could be too much!

Thank you again for a very useful utility.



Edited by Adreneline
Replaced image with the correct one.

Share this post

Link to post
Share on other sites


First at all, thank you for taking the time to develop this tool. Does it work with Olympus ORF files?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Astrofriend
      Sometimes you have problems that you can't find solutions to and you push it to the future how to solve it. In my data there are photos I took already in 2013 that I accidentally had the camera's auto rotation turned on. As a result, as the mount moved during the night, the orientation of some of the photos changed.
      Since then I have tried to change the rotation so that all of the raw photos will be back to a horizontal orientation again which many of the astro software require. Changing the orientation is easy in most software, but to save them in Canon's .cr2 format again I never found a solution to until now.
      Here's how I solved it:
      I have only done this on Canon's .cr2 files. Let me know if you can use this for other cameras, Nikon, Sony etc. You have at least to change the file extension inside the batch file.
    • By knobby
      Had a quick search but not found much info, I've just 'transitioned' from DSLR to a CMOS (AA 183C pro)
      Used to capture with APT or Backyard Nikon, save as RAW, DSS to stack and use autosave.tif to work on in Photoshop. Whats the general consensus on CMOS ?
      So far trying APT or Sharpcap, saving as FITS, stacking in DSS still and using autosave.tif into Photoshop. I keep seeing fits liberator mentioned ?
      Opinions gratefully received.  
    • By jdmgray
      Hi all, 
      Not sure I'm in the right place or not but I was hoping someone could help...
      I have an Altair Astro GPCamV2 and the box tells you to get the software from http://cameras.altairastro.com/ and that it will only work with Windows!
      I was wondering if anyone else has gotten this type of cam working on a Linux os before and what the steps were for doing so. (Other software that will work, terminal commands for the drivers etc.)
      thank you in advance ?
    • By jdmgray
      Hi everyone.
      I'm currently running Linux on my laptop and just wanted to know the best stacking software is for an amateur to use.
      I tried installing registax with wine but it didn't work.
      I've tried out PIPP and didn't really get on with it.
      So far the only one I've gotten my head around is Siril by free astro.
      Would like to know what other software there is that works well on linux that is good for amateurs who have just started playing around with this. 
    • By richardlawler
      Hello, all.
      I acquired an Ultrastar C for EAA last fall. (I only got a few chances to use it over the winter, but we got some desperately needed rain instead. So that's ok.)
      The Ultrastar C has been astounding on the few evenings where the fates have yielded to properly working equipment and clear skies.
      I'm looking for pointers to tools and techniques for post-processing the color FITs image stacks captured from Starlight Live. I'm on a Mac so that limits some of the software options available. 
      The docs for Starlight Live say there is a command line option ('-load-image-rggb') to reload a color FITs file into the program. Does this work from a Mac command line? 
      Are there any other Mac programs that can read the Bayer RGGB color FITs files exported from Starlight Live for manipulation. Or something that can demosaic and export the files for manipulation in Photoshop? Maybe Nebulosity4.
      - Richard
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.