ASTAP, the Astrometric STAcking Program, plate solver and FITS viewer


For MS Windows 64 bit:

For MS Windows 32 bit:

For Linux 64 bit:

If you need Linux 32 bit version, send me a request.

Questions, feedback to the ASTAP Forum


ASTAP introduction

ASTAP is a free stacking and plate solver program for deep sky images. In works with astronomical images in the FITS format, but can import RAW DSLR images or PGM, PPM, TIF, PNG and JPG  images. It has a powerful FITS viewer and the native plate solver can be used  by CCDCiel, APT or SGP imaging programs to synchronise the mount based on an image taken.

Main features:
  1. Stacking images including Dark Frame and Flat Field correction
  2. Native Plate Solver, command line compatible with PlateSolve2.
  3. Filtering of deep sky images based on HFD value and average value.
  4. Alignment using an internal star match routine,  internal Plate Solver or a call to a local version of
  5. FITS viewer with swipe functionality.
  6. FITS thumbnail viewer.
  7. Results can be saved to 16 bit or float (-32) FITS file.
  8. Export to 16 or 32 bit integer TIFF files, 16 bit PPM/PGM  files for best preservation or simple 8 bit PNG, BMP or JPEG.
  9. Mosaic building covering large areas using the astrometric linear solution WCS or WCS+SIP polynomial. 
  10. Background equalizing.
  11. FITS crop function.
  12. FITS header edit.
  13. Some pixel math functions and digital development process
  14. Available for 32 & 64 bit MS-Windows and Linux 64 bit.
This is a screen short of the stack menu. It contains several tabs for the file list and settings. File can be sorted on quality and values.The image can be visually inspected in the viewer by a double click on the file or using the pop-up menu.

Program requires FITS images as input, but it can also process 16 bit PGM /PPM files or  in 8 bit  PNG, TIFF or BMP files. For importing DSLR raw images 
DCRAW from David Coffin is used.

ASTAP is not:
A post processing software with advanced options like noise reduction and unsharp mask. It is only intended for convenient stacking of astronomical deep sky images.

Back to index

Program installation:


The installer will install it at c:\Program Files\astap . The single executable astap.exe can be used anywhere. 

Program works best using the internal alignment routine. Only for mosaics a plate solver should be installed

Linux installation:

The program is provide as an debian archive astap_amd64.deb which can be installed with the default installer.  Executable will be placed in /opt/astap

Program works well using the internal alignment routine. Only for mosaics a plate solver should be installed

Program operation, stacking astronomical images:

The purpose of the stacking routine is to combine astronomical images to reduced noise and to flatten the image.

 Ideally you should have collected

Only light frames are essential.

The automatic stacking process in ASTAP goes through the following steps:
  1. The flats will be combined to an average and the combined average flat-darks will be subtracted to  have a near ideal presentation of the vignetting called the master flat frame.
  2. The combined dark frames called master dark will be subtract from the light frames to extract the pure deep sky signal.
  3. The combined light frames, dark compensated in 2) will be flattened by dividing it by the master-flat resulting in the final deep sky image. Prior to this a small 2x2 or 3x3 median filter is applied  the master flat to reduce noise.

Operation of the stacking program

Start the ASTAP program. (In MS-Windows astap.exe, in Linux astap)

Call up the stack window using the Σ button.

a) Select frames
In tab
images, dark, flats, flat darks, select the select the images, dark, flats, flat darks (bias) frames. In most cases you could select all frames in tab images. The program will move the fames to the corresponding tab during analyse.

b) Analyse and remove bad frames
n tab images (for the light frames), press analyse and remove manually any poor image. Poor images can be detected by a too high HFD (Half flux diamater stars), low number of stars or high background value( by clouds) .
Loss of tracking could result in too low HFD value. If required inspect each image by double on the file name. The list can be sorted by clicking on the corresponding columns. Using the pop-up menu selected bad frames can be renamed to *.bak for deletion later.

c) Set parameters in tab stack method
In tab stack method select the stacking method, average or sigma-clip-average. For OSC camera images  select "Convert OSC images to colour". Select the correct Bayer pattern (4 options). Test the required pattern first in the viewer with a single image. The source images should be raw (gray)  without colour produced by  astronomical camera's.

d) Set parameters in tab alignment
Leave this to the default star alignment. Leave the parameters "star alignment and astrometric alignment at default values.

e) Classify by check marks
Leave all check marks 
initially unchecked. These classify options can be used later to combine the correct darks and flats and to stack several image series in one operation.

f) Press the stack button.
The darks and flats & flat-darks will be combined in a master dark and master flat frame. Then the program will combine the light frames to the final image and save it automatically. This will take some time.

g) Export
Use the resulting FITS file. Crop the sides if required using the pop-up menu. Equalise the back ground if required using the tool in tab pixel math. Export as stretched JPG or 16 bit bit stretched TIFF.  The stretched export follows the gamma and stretch setting of the display.

All the program settings and file selections will be save by leaving the program or click on the stack button.

Back to index

Mosaic building

This is possible with the internal Plate solver or local version of The reference of each pixel is the astronomical position. So stacking is not done against a reference image but against an position array set by the first image. If the oversize is set from the default 100 pixels to a  large value lets say 2000 pixels, the array is on all sides 2000 pixels larger then  the first image.  If the first image is 2000x1500 pixels, the stacking array will be 6000 x 5500 pixels large. So any following image will be placed in this 6000x5500 pixel array.  If the images are taken from different areas of the sky, the stacking will result in a mosaic as long the proceeding images are within this 6000x5500 pixels.

Here a suggested work method:
  1. Stack the tiles separately using method SIGMA-CLIP-average and use for the alignment the internal STAR alignment method.  Inspect the resulting tiles and crop them if required. You can also crop them later automatically with "Moasaic skip outside pixels" Do this for each color separately if you have separate files.
  2.  Stack the resulting tiles  using method MOSAIC (with oversize set at 2500 if the original tile images are 2328x1760 pixels) and select astrometic alignment using internal or the local for solving. (option --downsampling 2)
  3. Crop the stacked result to about 5000x5000 pixels. 
  4. If required, apply the median-equalising filter under tab Pixel Math to equalise darker areas.
  5. If you have seperate colours, check-mark the option classify by filter and stack the 3 seperate mosaics to colour.
  6. Adjusted the stretch range and save as JPEG, 90% quality.
Here an example mosaic x 4 of M31 made with ASTAP:

Here an example of a mosaic build of DSS images:

The size can be reduced by a crop function (right mouse button) later. Making the oversize too large could result in memory overload.

Back to index

The stack menu:

For a generic description how to stack see Program operation, stacking astronomical images

Stack multiple objects: Several objects can be stacked in one run. If the classify-by-object is check-marked, the program will stack all objects and save the results using the available darks and flats.

Analysing and removing of the bad ones: Before stacking the images can be analysed with the analyse button. Images with a high HFD value are most likely unsharp and can be inspected in the viewer by double click on the filename. The file can be renamed to *.bak by the pop-up menu to be removed later. Images with a high background indicating clouds or twilight should be removed/renamed to *.bak.

Sorting: Images can be sorted on any of the columns. For example if you click on HFD, the images will be sorted on HDF. You could then remove the images with the highest value or inspect them by double click on the file name.

Dark classification: If classify by exposure time and/or exposure time is check-marked the program will automatically select the correct darks or master dark. So it is possible to keep several dark files check-marked in the darks tab and the correct master dark will be selected automatically.

Colour stack and Colour filter classification: If
the classify-by-filter is check-marked, the stack routine will combine the available filters to a RGB image. If only Red + Green +Blue image are available they will be combined in a RGB image. If Luminance images are available it will first stack the RGB colors and then apply a most-common-filter and Gaussian blur on the RGB result. Finally the luminance image is coloured with the RGB result. The filter factor should be set typically near 20.

For nebula you could combine RGB or LRGB. If a luminance filter is detected the LRGB mode is used. First the RGB is combined, stars are removed using a most common filter, the image is then blurred with a Gaussian blur and and the colour is then applied luminance channel. Star colour is lost with this process. The filter names can be set in tab alignment

To record star colours use RGB only.

It could be better to stack in two steps. First prepare the Red, Green, Blue and Luminance stacks. Then run a stack again with the 
Red, Green, Blue and optional Luminance. Or if you could revisit the produced interim results in the RESULTS tab en copy them to the IMAGES tab using the pop-up menu. You could try different colout factors.

Image file names containing "_stacked" will be
un-checked by default to prevent stacks by accident are re-used. If required, just select the file and check-makr it again.

Organising images, darks, flats and flat-darks: Images placed in the first tab will be organised based on the FITS header keyword
IMAGETYP. So as soon you click on the image analyse button, dark and flats and flat darks/bias images will be move to the corresponding tab.

Keyword modification: The pop-up menu has option to update a keyword of multiple files if required.

OSC images (one shot colour images): To import raw files from digital camera, ASTAP can execute the command line program DCRAW from David Coffin. This program is included with the ASTAP Windows version. For Linux install by e.g. "sudo apt-get install dcraw.  See import
The stacking of  OSC images works best if you start with raw image before it is converted to colour. The raw colour images look mono, but the program will convert them later in the stacking process. There are 4 different Bayer pattern. They are identified as 00, 1,0, 0,1, 11 and can be set in
the stack tab "stack method". Try emperish which will result in the correct colours. Load a raw image in the viewer and convert it using tools menu option "convert bayer matrix"(CTRL+0). If the colours are not correct, just hit CTRL-Z to recover and try an other bayer pattern setting in stack tab "stack method"

Select for OSC image 2x2 mean for flats, see tab stacking. This will prevent any interfering patterns due to the 2x2 Bayer matrix.

Power down option after completion:  If stacking takes a long time you could activate this option and the program will be power-down the computer after completion.

Results tab.

The stack results are reported in the results tab. By a double click they can be viewed the viewer. The number of files and exposure times are given. With the pop-up menu it is possible to copy the image file path to the clipboard for use in a file explorer.

Back to index

Master flat:         Typical setting 2x2 mean
Darks filter:         Typical setting apply Gaussian blur of 3.0 below sigma 5.0. No restore of outliers/hot pixels.
Stacked image:    Best option is "Sigma clip average". For only 2 or 3 images or when you are in a hurry "average"will do.
Convert OSC:     For one shot color cameras the RAW images after applying darks and flats, have to converted into colour . This is called de-mosaic or debayer.
First set Bayer pattern correctly by loading a raw image (grayscale) in the viewer and try one of the de-mosaic patterns till the image colours match in viewer. If not hit CNTRL-Z to undo and try a different Bayer pattern.

The DSLR OSC images can be imported using the TOOL menu of the viewer. The de-mosaic method could be either bilinear interpolation  or super-pixel method. The bilinear interpolation is slow but keeps the resolution. The super-pixel method is about three times faster but reduces the image pixels size to half of the original. Super-pixel could be used if the images are near or over-sampled.

The DSLR OSC images can be imported using the TOOL menu of the viewer.  

The OSC/DSLR stacking works as follows:
1) Import the RAW images with the TOOLS menu of the viewer. The images will be converted to FITS
2) Load the RAW FITS image and optional DARKS, FLATS, BIAS or FLAT_DARKS in the TAB images and hit stack button.
The program will combine the dark and flat &flat-dark if available and create dark and flat masters. The image RAW's will be dark compensation and FLATS applied to have an equal background. Finally the images will be converted to colour and stacked.

If your using a H-alpha filter in front of an OSC camera, by using the super-pixel de-mosaic method, you could just remove the green and blue signal to create a noise free red image and then convert it to mono. This makes processing simpler. There is no interpolation between the R,G,G and B pixels, so any noise from G an B pixels can be separated from the red.

Oversize: This could be 0, 100 or much larger for mosaic's   If  you want to  make a 2x2 mosaic, the overlap should at least the width of  the images.

The setting will be save if your either exit program or start a stack.

There are test button for dark and mean filter. They will be aplied on the image in the viewer.

Typical cold CMOS master dark:

Application of Gaussian blur under sigma 5:

Gaussian blur under sigma 5 and hot pixel removed:

Back to index

The alignment menu:

For alignment there are three options, internal star alignment,  native plate solver or a local version of For mosaic building you have to use the Plate Solver of

 Internal star alignment

This internal star matching alignment is the best and fastest option to stack images. It is not suitable for mosaics. No settings, fully automatics alignment for shift in x, y, flipped or any rotation using the stars in the image. It will work for images of different size/camera's with some limitations.

The program combines four close stars into a triangular pyramid ( and compares the six triangular pyramid dimensions with triangular pyramids of the first/reference image. It selects at least the six best matches and uses the centre position of the triangular pyramids in a least square fitting routine for alignment. 

There is only two settings relevant but normally you don't have to change them.

The following image shows the triangular pyramids used in an astronomical image:

Background info: A triangular pyramid (or tetrahedron) drawn from 4 star positions has six edges. The five shortest edges are divided by the longest side to scale them independent of the image scale.  The final triangular pyramid definition is then the scaled length of the five edges, the centre mean position and the pixel length of the longest edge. For pyramid matching the scaled five edges are used. There scaled lengths will be independent on the image scaling. This will give a number of pyramid matches. From the matching pyramids list,  the not scaled sixth edge is used to calculate the mean and standard deviation and outliers of more then 3 * sigma are removed. (three times the standard deviation). From the remaining list of pyramids, the central mean positions are used for LSQ fitting in two dimensions

For each star, the pyramid is constructed from the nearest stars. Some edges could overlap. Duplicates are removed. Duplicates could occur from four close but lonely stars. The pyramid selection can be demonstrated by the "draw pyramids"button in the alignment tab. You could reduce the number of pyramids drawn by the setting"maximum number stars used".

Astrometric alignment.

There are two option for astrometric alignment. The internal solver is quicker and adequate for most stacking. If somehow the alignment is not working it is possible to use a local version of  ""

   Internal astrometric solver (plate solver). The works with the same four star pyramids as for the Star alignment option. The pyramids are compared with the G17 star database (to be installed in the program directory). It has the following settings:

At the moment the solver has the best sub-pixel accuracy. 

For those are interested:  
Background info, how does the ASTAP plate solving works internally local solver:

   Some guidelines for astrometric stacking using

Manual alignment.

This option allows alignment of the images based on a single star, asteroid or comet. If this option is activated, the list of images in the image tab turns red. Double click on each image in the list and click on the star/comet of asteroid to be used as reference. This object is then marked with a little square. The position will be auto centered. (and the X,Y position will be added to the list)  If all images in the list are turned green, so contain a value, then click on the stack button.

For objects which are moving in the sky, select the stack option "average" and not option "sigma clip".

Back to index

Pixel math.

 Several options including background equalising.

Back to index

Additional functionality:

The viewer has a preview function. After opening select Preview FITS files. The preview is displayed in the ASTAP viewer. The current zoom and position is maintained so you could study the corner of a series images on image quality.

The file open menu with preview selected:

ASTAP viewer screen shot:

If the image is solved, it is possible to add deep sky annotations. See pull-down menu TOOLS:

Inspection on pixel level:


With the batch routine several FITS image can be "plate solved".   Raw images of OSC (color) sensors using a Bayer matrix can be coverted to color.

Command line options:

ASTAP can imitate PlateSolve2 and add the plate solution to the FITS header. Also PNG, JPEG, TIF, BMP files can be plate solved if an estimate of the center position is given. See  Usage as plate solver and command line options:.

There is a big variation in FITS file keywords and usage. If your FITS file is not read, please send me the file for testing.

Text entry option:

Back to index

CCD inspector

ASTAP has a CCD inspector under tools for median HFD value and Tilt measurement.  This will quickly show any focus problem in the corners:. The squares are 5 times the HFD value. 

Back to index

Background equalization tool:

Back to index

Local equalise tool:

Where to find:   pop-up menu of the viewer.

Objective: To removes local darker areas/ spots in a stacked image.

Usage: Select the area while holding the right mouse button down. Select the local equalising option. Darker areas will be partly leveled to the mean back ground value. Apply a few times.

Remarks:  No CTRL-Z functionality available. Save your image before applying.

Back to index

Usage as plate solver and command line options:

For images in the viewer:

The simplest way to solve an image is just to load an image in the viewer and hit the solve button. Some settings are available in the ∑  menu under tab alignment. 

The solution will be added to the fits header and center of the image will be displayed in the log ∑  menu. Click on the save button to save the FITS file with the solution. With the solution, the status bar will show the astronomical position of the mouse pointer.

Command line, ASTAP style

The program can be executed using command line options to plate solve images. E.g.  ASTAP -f  home/test/2.fits   -M  10  -m 15  -r 999 

The program will accept FITS files, JPG, PNG, BMP or TIF files.

ASTAP plate solver command line The RA,DEC, EXP options are intended for none FITS files.
Not required for FITS files having the values in the header.
parameter unit remarks
-h help info
-help help info
-f file_name
-M start_magnitude For a 10 seconds exposure
-m limiting_magnitude For a 10 seconds exposure
-fov field of view for image degrees No need to be accurate
-r Radius search field degrees Could be set at 5 or 10 degrees.
-ra center_right_ascension degrees
-dec center_declination degrees
-exp exposure_time_image seconds
-update update the fits header with the found solution
-annotateproduce a deep sky annotated jpg fileSame name as input file extended with _annotated

Preference will be given to the keyword values in the FITS header.

The program produces both a .wcs file containing  the solved FITS header only and an INI file using the standard FITS keywords.

Example of the INI output file:

PLTSOLVD=T                                     // T=true, F=false
CRPIX1= 1.1645000000000000E+003               
// X of reference pixel
CRPIX2= 8.8050000000000000E+002                // Y of reference pixel  
CRVAL1= 1.5463033992314939E+002                // RA of reference pixel (deg)                   

CRVAL2= 2.2039358425145043E+001                // DEC of reference pixel (deg)                   
CDELT1=-7.4798001762187193E-004                // X pixel size (deg)
CDELT2= 7.4845252983311850E-004                // Y pixel size (deg)
CROTA1=-1.1668387329628058E+000                // Image twist of X axis        (deg)
CROTA2=-1.1900321176194073E+000                // Image twist of Y axis        (deg)                
CD1_1=-7.4781868711882519E-004                 // CD matrix to convert (x,y) to (Ra, Dec)  
CD1_2= 1.5241315209850368E-005                
// CD matrix to convert (x,y) to (Ra, Dec)                                   
CD2_1= 1.5534412042060001E-005                 
// CD matrix to convert (x,y) to (Ra, Dec)             
CD2_2= 7.4829732842251226E-004
                // CD matrix to convert (x,y) to (Ra, Dec)

If ASTAP is command-line executed in MS-Windows it will be shown by a small ASTAP tray icon on the right side of the status bar. If you move the mouse to the ASTAP tray icon, the hint will show the search radius reached. To refresh the value move the mouse away and back.

Command line, usage as PlateSolve2 substitute:

Rename the ASTAP.EXE program as Platesolve2.exe and call it instead of PlateSolve2. The solution will be written to a  file with an extension APM at the same location as to original file. In the ∑  alignment tab you could set a conversion to FITS & binning to reduce the dimensions of the resulting file. Reducing dimensions is required to allow speedy display in a planetarium program such as HNSKY.

Example for APT:

Rename or copy astap.exe to platesolve2.exe. Then select in APT, pointcraft, settings the directory where this surrogate platesolve2.exe (=astap.exe) is located.

Note that APT saves the pointcraft image to solve to: .... TemporaryStorage\ImageToSolve.jpg

Set in HNSKY the FITS path to .... TemporaryStorage\ImageToSolve.jpg (This is the location where APT saves the pointcraft image to solve to)
After solving, either refresh HNSKY with space bar or move to map to the object or open the FITS file in the file menu.

  1. ASTAP loads the image specified  in the command line. (from APT)
  2. ASTAP solves the image.
  3. The solution is written to the APM file. APT will read it.
  4. If set in the ∑  alignment menu, the JPG is saved as FITS with binning as specified. The FITS file will also contains the solution and could be displayed in a planetarium program. Binning should be set such that the file dimension are near 300 or 400 pixels wide/height for speedy display in a planetarium program.

Example for SGP, Sequence Generator Pro:
For SGP, PlateSolve.exe is located at C:\Users\you\AppData\Local\SequenceGenerator\
  1. Rename Platesolve2.exe to something like PlateSolve2.exeorginal
  2. Place ASTAP.exe at the same directory together with the G17 database.
  3. Rename ASTAP.exe to Platesolve2.exe

Back to index

Installation of the external plate solver:


Install a local copy of (via ANSVR  or  Astrotortilla)   as the astrometric solver. Or alternatively if you have Win10, 64 bit Creation edition you use the new Linux sub-system

ANSVR: The ANSVR link contains a newer compilation of made for SGP. It runs as a Linux program under Cygwin in MSWindows. Follow up to installation step 9. The link you have to put in ASTAP is as follows:


Adapt "user_name" to the login name used in Windows.

The server program ANSVR is not required. Remove the ANSVR shortcut in the startup menu. Location:

C:\Users\user_name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Alternative Linux sub-system in Win10 64bit Creators edition

Path for the solver program
ANSVR installation:
Astrotortilla installation:
Win10 subsystem:

Linux installation:
The single executable astap could be used anywhere. Standard directory could be c:/opt/astap but also at your home folder.

You need either a local copy of of Wine & PlateSolve2 

Installation of is described at installation. To get the source: sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm libpng-dev libjpeg-dev python-numpy python-pyfits python-dev zlib1g-dev libbz2-dev swig libcfitsio-dev

Path to the solver program "solve-field" could be:


For PlateSolve2, install Wine first. Then extract PlateSolve2 at $HOME/.wine/drive_c/PlateSolve2.28   The separate star database UCAC3 could be extracted at $HOME/.wine/drive_c/PlateSolve2.28/UCAC3PS.  
PlateSolve2 requires the msvbvm60.dll to run. Try to find a copy and place it in $HOME/.wine/drive_c/PlateSolve2.28 or alternatively install winetricks vb6run
Run PlateSolve2 in Wine and set in menu FileConfigure Catalog Directories the path to the UCAC3 star catalog.  

Importing  raw images from digital cameras

This ASTAP version can import raw images from almost any digital camera, For this ASTAP executes the  DCRAW program from Dave Coffin. DCRAW is included with the ASTAP Windows edition and can be installed in Linux by the "sudo apt-get install dcraw" command. 

The file convert option is in the pulldown menu under TOOLS. ASTAP will execute DCRAW with parameters -D -4 and this will produce 16 bit PGM raw files. ASTAP can read these PGM files and convert them to a 16 bit FITS. After conversion the intermediate PGM are no longer required and can be deleted manually. The FITS can be used in the stacking. The Bayer matrix conversion to colour will be applied later in ASTAP. With this method the full depth of the original RAW files will be preserved

Background information:

The stacking process for one shot color color camera's will be mathematically executed as follows:

The master flat is calculated as:

master flat: = (1/n ∑ [flat] - 1/n ∑ [flat darks] )

Where a bias image could be used as flat-dark image. The masterflat should be averaged by a 2x2mean to remove Bayer matrix artifacts.

Each image is calculated as:

(image- {∑ [darks]/n} ) / master flat

Then the Bayer matrix is applied and finally the images are stacked in mode average or sigma clipped.

So for average stack:

final image:= 1/n ∑ Bayer(image)

Back to index

Thumbnail viewer for FITS files

ASTAP has a FITS thumbnail viewer (ctrl-T). This could be useful to browse your FITS files. By clicking on the thumbnail it will be opened in the viewer. With a right mouse button click some options are available as changing directory, copy, move, rename or rename to *.bak.

The thumbnail size is depending on the form size. Make it larger, the thumbnails will follow. Thumbnails are organized in 3*X. So the thumbnails are pretty big by purpose. The images are fully loaded in memory so it will consume some memory and time. So don't try get thumbnails of 400 images.

Back to index

Send a message if you like this free program. Feel free to distribute !

Succes,  Han  K

Counter since 2017-11-15: