Astrofriend's homepage

Advertisement / Annons:

Valid CSS!

All pages shall now have been validated

Info Cookies (Kakor) / GDPR


Advertisement /

Twitter @AstrofriendLars

Follow Astrofriend

Project News

An introduction to AstroImageJ


  1. Introduction
  2. Download and Installation
  3. My own downloadable macros
  4. How to use "Masterflats from CR2 files" macro
  5. How to use "Calibrated object files from CR2 files" macro
  6. How to align rggb files
  7. How to stack rggb object files

I take no responsibility or liability for what are written here, you use the information at your own risk!

3, My own macros:

Here I have my own developed macros and they can be downloaded here. You download and use them at your own risk and make sure you have a backup of your files!

Canon CR2 files special macros

It's a good idea to separate the CFA-files to it's color components. It make it easer to make good quality masterflats and also save RAM memory when processing. The technique to do dark and bias calibration I do here is a little special. Se the link on first page about "Image Reduction".

It's my first attempt to write macros to AIJ so expect them to have some bugs!

The first two macros I have are:

  • Masterflats_from CR2 files

This macro does most of it's process by automatic. Read all CR2 files it find in the map, convert to CFA 16-bit Tiff, store temporarily, Demosaic, create Masterflats for Red, Green1, Green2 and Blue. You don't need any bias or darks, it use Canon's overscan regions to create the bias that it subtract from flat images.

version 20170930 (latest)
Only cosmetic changes

version 20160515
First release

  • Calibrated_object files from CR2 files

This macro read your image CR2 files and calibrate them with the Master flats created above. Also to this one there is no need for dark or bias files. If you don't want flat calibration you can edit the macro file with Notepad and change a parameter to disable flat calibration.

version 20170930 (latest)
Added option to calibrate with or without flats
change how to add camera data in filename

version 20170926
Added option how to set output filename

version 20160515
First release

These two macros only works for Canon EOS at the moment, I have tested on Canon 350D, 5D and 6D. I have had a look at Nikon nef files and Sony arw files, they don't seem to have this important overscan area.

New general DSLR macro

For first time I now have included a third macro, the:

  • Open_DSLR raw files and convert to cfa Tiff 16 bit

With that macro it maybe is possible to open all DSLR files that DCRaw can handle, and not just one by one, it operate in batch mode. Test it for your non Canon DSLR and let me know if it works for you. It opens raw files and convert to cfa Tiff 16 bit files and store under map cfa, a sub map under your raw file map. I have tested with Nikon D3 nef and Sony A7RII arw files, it looks to work.

You must edit the parameter to the file type in the macro to your specific camera raw files extension. And of course you can process Canon CR2 files by this macro too.

version 20170930 (latest, Beta)
First release

Organize your raw files something like this and it will be easier to handle:


--------------- map-dark
--------------- map-bias
--------------- map-flat

After you have run above macro for each map you find new sub maps under these maps with your processed files (Tiff files). Rename dark maps for each temperature, iso and exposure length. Rename flat maps for each optics. Rename each bias map for iso setting. You don't want to over write them!

When you processing these files you must use AIJs normal processing tools for calibration. AIJ has a lot of support for that and here I have a collection of links with information how to do that:

My own tutorial here, part 4 and 5 are special for Canon macros, other parts are more general for other cameras.


All three macros are included in this zip file.

Canon CR2 special macro:

Download and unpack the files in the plugins directory of AstroImageJ, see below how it should look.

AstroImageJ, AIJ: file system plugin

Even if it's a macro it should be installed in the plugin directory.

When you start AstroImageJ it should come up like this:

AstroImageJ, AIJ: plugin files

After this it's easy to run the macro, just click on it. Read on the following pages how to used them.

On these forums you can ask questions or give comments, it could take a while until there is an answer:

I will later concentrate me on one of these forums where I find most users of AIJ, I think the Cloudy Nights forum is best to use for this surpose.

Go Back to content

Go Back
Next: How to use "Masterflats from CR2 files

Advertisement / Annons: