Jump to content


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
Link to comment
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
Link to comment
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



Link to comment
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.


Link to comment
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?

Link to comment
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.
Link to comment
Share on other sites

  • 2 years later...

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

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.