PixInsight AutoIntegrate.js Script

Download links

Download JavaScript file.


Source code in GitHub.



AutoIntegrate is a PixInsight script to integrate FITS (and other) image files and run a basic image processing workflow to create a final image. Script has a GUI interface where some processing options can be selected.

After running the script there will be integrated light images and automatically processed final image. LRGB, color and narrowband files are accepted.

Below is a sample output from AutoIntegrate script with default options.

Data for this image is from Slooh Canary One remote telescope.

Files accepted by the script

Script accepts all files that are supported by PixInsight. It can be used with FITS files from telescopes, or RAW files from DSLR. It is targeted for use with files that are already calibrated. Many remote telescope sites offer already calibrated files, or calibration can be done manually.

Files from remote telescope systems like Slooh, Telescope Live, iTelescope and Deep Sky West have been tested and they work fine. Also camera RAW files can be used and they are treated as color files.

How the script recognizes different files

  1. First script checks if the file has a FILTER keyword that specifies the image as Luminance, Red, Green, Blue, Ha, SII, OIII or Color data. The following FILTER values are recognized: Luminance, Clear, L, Red, R, Green, G, Blue, B, SII, S, Halpha, Ha, H, OIII, O, Color. If there is a FILTER keyword but it is not one of the recognized values, the file is treated as a color file.
  2. If the FILTER keyword is not found then files that end with _L, _R, _G, _B, _H, _S, _O or _C are treated as filter files. For example ngc6514_R.fit is treated as a Red filter file.
  3. Otherwise files are assumed to be color files.

Running the script

Steps to run the script

  1. Open Script Editor in PixInsight
  2. Open file AutoIntegrate.js
  3. Press F9 to run the script in the editor
  4. When script dialog opens, click Run
  5. In the file dialog, select all *.fit files and wait until the script completes.

Erik Westermann has written more detailed instructions in his blog article PixInsight AutoIntegrate.js Processing Script

AutoIntegrate dialog screen

Below is the script dialog screen. Often it is best to start with default options and just hit the Run button. Script will then ask for files to process.

YouTube videos

I have created short YouTube videos that show the workflow with AutoIntegrate script.



Processing RGB files

Script supports LRGB, RGB and Color image workflow.

Basic RGB workflow using AutoIntegrate is described here: PixInsight Image Processing Workflow

Processing narrowband files

Also narrowband images are supported by the script. They are processed mostly the same way as other images. Main difference is that you can choose the color palette that is used when mapping narrowband images to RGB channels.

Basic narrowband workflow using AutoIntegrate is described here: PixInsight Narrowband Processing Workflow

Below is a sample output from AutoIntegrate script when using narrowband data and SHO color palette. Otherwise it was run with default settings but Remove green cast and Fix star colors options were checked.

Thanks to Erik Westermann for providing narrowband data.

Narrowband to RGB mapping

A special processing is used for narrowband to (L)RGB image mapping. It is used to enhance (L)RGB channels with narrowband data. It cannot be used without RGB filters. This mapping is similar to NBRGBCombination script in Pixinsight or as described in Light Vortex Astronomy tutorial Combining LRGB with Narrowband. You can find more details on parameters from those sources.

If narrowband RGB mapping is used then narrowband Color palette is not used.

With narrowband RGB mapping you can choose:
- Mapping of narrowband channels to (L)RGB channels
- Boost for (L)RGB channels
- Bandwidth for each filter
- Test the mapping with a test button

Fixing linear defects

It is possible to automatically fix linear column and row defects by using linear defect detection algorithm from PixInsight LinearDefectDetection.js script. Defect information is used by CosmeticCorrection to fix the defects.


It is possible to run manually background extraction, histogram transformations or other steps on the integrated images and then continue automatic processing from there.

Basic RGB workflow using AutoIntegrate includes also the use of AutoContinue and is described here: PixInsight Image Processing Workflow

Extra processing

The following extra processing can be applied to an image

If multiple options are selected they are executed in the order listed above.

In case of Run or AutoContinue, extra processing steps are applied to a copy of the final image. A new image is created with _extra added to the name. For example if the final image is AutoLRGB then a new image AutoLRGB_extra is created. AutoContinue can be used to apply extra processing after the final image is created.

There are also narrowband specific extra processing options in the Narrowband processing section.

From a drop down list it is possible to select an image into which extra processing is applied. With the Apply button extra processing is run on the selected image.

Batch mode for mosaic images

Batch mode is intended to be used with mosaic images. In mosaics there are several images and typically the same basic processing options are used for all images. In Batch mode AutoIntegrate script automatically asks for files for the next mosaic panel. You can freely choose the directories for images. Script creates a final processed image which has the same name as the directory where images were read. So if images are from directory P1 then the image name will be P1. At the end of the script all batch mode images are left open and all intermediate images are closed.

When batch files are ready for further processing is it possible to save all files by clicking a button in section “Save batch result files”. Batch mode adds a keyword to each image and it is used to find files saving. It is possible to save images in PixInsight .xisf format, 16-bit TIFF format or 8-bit TIFF format. If you want to assemble the final image in Photoshop, save images in 16-bit TIFF format.

Batch mode keyword is saved on disk with .xisf format but not with TIFF format. If you want to process images later and use batch save then you should save files also in .xisf format.

Some tips for using AutoIntegrate script

Very often you get good results by running the script with default settings and then continue processing in Pixinsight.

Always before running the script you should the quality of the data using a Blink tool. Remove all files that have movement like wind effect or clouds.

Sometimes you may want to do some shadow cleanup with HistogramTransformation tool. Depending on the image you can try clipping shadows between %0.01 and %0.1. If default stretch creates too bright image try moving the histogram to the left using HistogramTransformation tool.

If an image lacks contrast it can be enhanced with the CurvesTransformation tool. Changing the curve to a slight S can be helpful. CurvesTransformation can also be used to increase saturation.

If the background is not even then tools like AutomaticBackgroundExtractor or DynamicBackgroundExtractor can be helpful. Script can run AutomaticBackgroundExtractor automatically if needed.

Further enhancements may include masking, noise reduction, sharpening and making stars smaller. Often tools like HDRMulticaleTransform and LocalHistogramEqualization can help with details in the image.

Some of these steps can be run by the AutoIntegrate script with setting Extra processing options.

If you want to integrate only a single channel, you can do it by clicking Monochrome and Integrate only options, and then selecting correct files.

Tips for processing One Shot Color files

Default options are typically a pretty good start for most images but sometimes a few changes are needed for OSC (One Shot Color) files. If there is a strong color cast and/or vignetting it is worth trying with Use ABE on combined images and Use BackgroudNeutralization options. Sometimes also choosing Unlinked in the Link RGB channel option helps. Examples where these options may be useful are DSLR files and Slooh Canary Three telescope.

Tips for combining mosaic panels

When doing a mosaic, after running AutoIntegrate script I often do just HistogramTransform at Pixinsight. With HistogramTransform I just try to get the panels visually close enough. Then I save panels as 16 bit TIFF and move to Photoshop.

In Photoshop I load the panels as layers (File/Scripts/Load Files into Stack…). Then I align them using a Difference blending mode (select all layers and change to Difference mode). It makes it quite easy to adjust panels correctly. After that I change the blending mode back to normal. At this point it is still possible to adjust individual panels to make them match more closely.

I blend layers together using Edit/Auto-Blend Layers. Usually it works very well and you get a nice blended image. After that you can flatten the image and continue processing as a single image in Pixinsight or Photoshop.

AutoIntegrate in Remote Astrophotography site

Erik Westermann has a web site Remote Astrophotography. He talks about AutoIntegrate in his blog post PixInsight AutoIntegrate.js Processing Script. It has a lot of useful information so please check it out.

List of steps run by AutoIntegrate

Below are listed PixInsight processes used by AutoIntegrate script with default LRGB processing. AutoIntegrate writes processing output to the Process Console window and to AutoIntegrate.log file. Details of processing steps can be found from the header block of the source code.


PixInsight scripts that come with the product were a great help when developing this script. Website Light Vortex Astronomy was a great place to find details and best practises when using PixInsight.

Routines ApplyAutoSTF and applySTF used by AutoIntegrate are from scripts that are distributed with Pixinsight.

This product is based on software from the PixInsight project, developed by Pleiades Astrophoto and its contributors (https://pixinsight.com/).