← Scripts

PixInsight script

Image Combination

Combines open PixInsight images as layers via PixelMath: blend modes, masks, starless + stars, mono channels to RGB/HOO/SHO/LRGB, mean/maximum/minimum/median, with preview, magnifier and histogram.

Preview: window of the Image Combination script in PixInsight
The script in PixInsight (click to enlarge).

The minimum version 1.8.9 is an assumption and has not been tested. I work with PixInsight 1.9.6. I cannot judge older versions.

Download ZIP (283 KB) Manual as PDF (1.5 MB)

Installation

Option 1: via the repository (recommended)

Set it up once and get updates directly inside PixInsight.

  1. In PixInsight open Resources › Updates › Manage Repositories.

    PixInsight: Resources > Updates > Manage Repositories.
    PixInsight: Resources > Updates > Manage Repositories.
  2. Copy the repository address (with the trailing slash):

    Copy the repository address from this page with “Copy”.
    Copy the repository address from this page with “Copy”.
  3. In the window click Add, paste the address and confirm with OK.

    Choose Add, paste the address and confirm with OK.
    Choose Add, paste the address and confirm with OK.
  4. The new entry is at the end of the list. Close the window with OK.

    The new entry is at the end of the list. Close with OK.
    The new entry is at the end of the list. Close with OK.
  5. Then choose Resources › Updates › Check for Updates. PixInsight downloads the repository information; the warning that the repository is unsigned is expected (see below).

    Resources > Updates > Check for Updates.
    Resources > Updates > Check for Updates.
    PixInsight downloads the repository information. Then tick the AoP packages you want and install them.
    PixInsight downloads the repository information. Then tick the AoP packages you want and install them.
  6. Tick the AoP packages you want and start the installation. Then quit PixInsight with File › Quit PixInsight: updates are applied only when it quits.

    Updates take effect only after a restart: File > Quit PixInsight, then start it again.
    Updates take effect only after a restart: File > Quit PixInsight, then start it again.
  7. Start PixInsight again. The script is now under Script > AoP Astro Suite > Image Combination. If the entry is missing, run Script › Feature Scripts › Regenerate once.

    After the update: Script > AoP Astro Suite lists the installed scripts.
    After the update: Script > AoP Astro Suite lists the installed scripts.

PixInsight warns that the repository is unsigned. That is expected: I do not (yet) have a signature from the PixInsight developers. PixInsight additionally verifies every package with a checksum. Do not also add the same script from another folder via “Feature Scripts › Add”, or the menu entry will appear twice.

Option 2: ZIP file by hand

  1. Download the ZIP and unpack it to a permanent location (not the Downloads folder: the script is loaded from there at every start).

  2. In PixInsight open Script › Feature Scripts….

    Without the repository: open Script > Feature Scripts…
    Without the repository: open Script > Feature Scripts…
  3. In the window choose Add and select the unpacked folder with the .js file, then Regenerate and Done.

    Feature Scripts: Add (choose the folder with the script), then Regenerate and Done.
    Feature Scripts: Add (choose the folder with the script), then Regenerate and Done.
  4. Start it via Script > AoP Astro Suite > Image Combination.

    After the update: Script > AoP Astro Suite lists the installed scripts.
    After the update: Script > AoP Astro Suite lists the installed scripts.

Update

  • Repository: Resources › Updates › Check for Updates, tick the package, install, and restart PixInsight. The update does not take effect without a restart.
  • ZIP: Unpack the new ZIP into the same folder and overwrite the old file, then run Script › Feature Scripts › Regenerate. Desktop icons belong to one specific file version and have to be created again afterwards.

Videos

Videos for this script will follow.

Manual

The manual is on this page and as a PDF (German and English in one file). Download PDF

1. What the script is for

The script combines several open PixInsight images as layers, much like in Photoshop: every layer has a blend mode, an opacity and, if you like, its own mask. Typical jobs are putting a starless image and a stars image together, combining mono channels into a narrowband colour image (HOO, SHO ...) or LRGB, adding a luminance, and averaging several versions.

PixelMath computes the result. A preview shows every change at once. The final image is only created when you click one of the two result buttons at the bottom. Your source images stay unchanged (unless you choose "Replace target with combination").

2. Requirements

  • PixInsight 1.8.9 or newer. The script is developed and used with PixInsight 1.9.6 (build 1713). Whether it runs with versions older than 1.8.9 has not been checked. It only uses the PixelMath process.
  • Open images in PixInsight that are all the same size (same width and height in pixels). The script rejects an image of a different size.
  • Images may be linear (unstretched) or already stretched. The auto-stretch of the preview only changes the display, never the result.
  • Mono and colour images are allowed. For the quick templates, image names such as Ha, OIII, SII, L, R, G, B, Starless, Stars help (case does not matter, German and English).
  • Enough memory for the image size: the script creates helper images for the preview and cleans them up again.

3. Installation

  1. Put the folder with AoP-ImageCombination.js at a permanent location (any folder).
  2. In PixInsight: Script > Feature Scripts > Add, choose this folder, then Done. Alternatively run it once via Script > Execute Script File.
  3. Start it with Script > AoP Astro Suite > Image Combination.
  4. After an update run Script > Feature Scripts > Regenerate once. Create desktop icons you dragged from the triangle at the bottom right again.

The script does not need a particular folder. Log files are created in a folder in your user folder (see section 5).

4. Operation step by step

The empty interface after start: layers and settings on the left, preview in the middle, histogram and corrections on the right.
The empty interface after start: layers and settings on the left, preview in the middle, histogram and corrections on the right.

The dialog has three columns: left layers and their settings, middle the preview, right histogram, magnifier, post-processing and result. Every button, slider and field has a hint when you hover the mouse over it. The help icon at the bottom right opens the full help.

4.1 Quick start

  1. Open the images in PixInsight.
  2. Choose a fitting Quick template (e.g. "Mono H+O+O starless" or "Mono L+RGB"). The script finds the images by name, creates the layers in the right order and sets blend mode, hue and output name. If an image is missing, a red placeholder layer stands there: click it and pick an open image in the field "Choose image".
  3. Check the result in the preview and adjust sliders.
  4. Click "Create combination as new image" at the bottom right. The finished image opens as a new window.

It also works by hand without a quick template: choose an image in Add layer and click the plus. The icon next to it re-reads the list of open images.

Example quick template “Combine starless + stars”: two layers, stars on top in Screen blend mode.
Example quick template “Combine starless + stars”: two layers, stars on top in Screen blend mode.

4.2 Header: language, theme, combination

  • Deutsch / English: switches all texts and hints. The choice is remembered.
  • AoP Theme / PI Theme: dark AoP design or the standard PixInsight look. The choice is remembered.
  • Combination: "Blend layers" works from bottom to top with each layer's blend mode. "Mean", "Maximum", "Minimum" and "Median" calculate over all visible layers (like avg, max, min, med in PixelMath). The median pays off from three layers; with two layers it equals the mean.

4.3 Layer list

  • The foreground is at the top, the background at the bottom. New layers are appended at the bottom.
  • Check box on the left: switch a layer on or off. S: solo, shows only this layer in the preview.
  • The selection box in the row changes the layer's image. The row shows opacity, blend mode, target channel and "Mask" if a mask is active.
  • The selected layer (highlighted) shows arrows (change order) and X (remove).
  • Own template: choosing one applies saved settings from bottom to top to the layers. The disk icon overwrites the chosen template (after a prompt), "Save" creates a new template under a new name, X deletes a template. Settings are saved without image names.

4.4 Settings of the selected layer

  • Image adjustment (acts before blending): Opacity, Brightness | Contrast, Gamma, Saturation | Vibrance. With linear, unstretched images the values are close to zero, so gamma and gain work better than brightness and contrast. Vibrance is like Photoshop's: pale colours are raised more than strong ones.
  • SCNR (%): removes a colour cast in red, green or blue for each colour layer (method "average neutral").
  • Colourise (mono layer): the check box "Colourise mono layer" enables the hue (0° red, 60° yellow, 120° green, 180° cyan, 240° blue, 300° magenta). The greyscale image becomes the brightness of this colour. Stack several coloured layers with blend mode Screen.
  • Blend mode: Normal, Screen, Multiply, Add, Overlay, Soft light and more, plus "Sigmoid blend" and "Threshold" (layer visible only above the threshold, the width makes the transition soft, handy for stars over starless) and the luminance modes. A short explanation stands below the mode. Target channel limits the layer to R, G, B or combinations. Gain multiplies the layer before the image adjustment.
  • Mask of the selected layer: switch the check box on and choose the source: greyscale mask image of the same size, luminance of this layer, or luminance of another image (also a colour image). White = layer fully visible, black = invisible. Black point | white point limit the range, blur smooths the edges, strength fades the mask, Invert mask reverses it. "Show mask in preview" overlays the mask in red on the image (red = protected). Every layer has its own mask. With mean, maximum, minimum and median the bottom layer is the base: its mask has no effect there, so put the mask on the layer above.

4.5 Preview (middle)

  • Preview: preview resolution (Fast 900 px up to Full 1:1). The preview is reduced; the finished image is always created at full size.
  • Auto-stretch (with the strength slider) and RGB linked only affect the display.
  • Display: 24 bit (full colour depth) or 16 bit as a simulation to judge banding.
  • A/B switches between the bottom layer and the result, Blink does that automatically.
  • Clipping: red = highlights clipped at 1.0, blue = shadows at 0.0; the shares are shown under the preview.
  • Show measurement areas: shows the frames for background, white balance and measurement area.
  • Zoom icons at the top, the mouse wheel zooms, dragging moves.
  • Section 1:1 computes only the visible area at original resolution (fast, even for large images). Switch to original resolution computes the whole image at original resolution; this takes much longer for large images. A second click returns.

4.6 Right column

  • Diagram (histogram): distribution of the values per channel (R, G, B, L) before auto-stretch. Mouse wheel zooms X, Shift + wheel zooms Y, double click restores the default view.
  • Magnifier: shows the pixels under the mouse enlarged, with position and values R, G, B, L next to it.
  • Background: "Neutralise background" measures a sky area without nebula and stars and removes colour casts. "Choose area automatically" finds the area itself. By hand: Draw area and drag a rectangle in the preview, or choose a preview of an open image in the selection box (the preview must belong to an image of the same size). Clear area switches the automatic back on. The field shows "automatic", "by hand" or the name of the preview.
  • White balance: adjusts red and blue so that the signal above the sky is equal in all three channels (green stays). The area works like for the background: automatic, drawn, from a preview or "Whole image".
  • Exposure: exposure in stops (EV), offset and gamma on the finished result, before it is clipped to 0 to 1. Auto suggests values, Reset sets everything to zero.
  • For background, white balance and exposure, "also in result image" applies to the finished image. Without the tick the settings only act in the preview.
  • Match (LinearFit): matches mono layers of a group (R, G, B or Ha, SII, OIII) to a reference. Only for linear, unstretched images. The table shows the correlation r; below 0.8 the relation is weak.

4.7 Result

  • Output name: name of the new image (the quick template suggests one, e.g. HOO or LRGB).
  • Create combination as new image: creates a new image at full size.
  • Replace target with combination: writes the result into the image chosen in the field Target (undo with Ctrl+Z in the target image). "automatic" takes the bottom layer. The target must be the same size, and a colour image for a colour result.
  • The progress bar shows the stages (PixelMath reports no intermediate progress).
  • The icons at the bottom right: triangle (drag onto the PixInsight desktop = script icon with all settings; the source images must be open at start), preview on/off, help, reset all, close.

5. Log and settings

  • Every session writes a log file (the last 10 are kept). The default is a folder AoP-ImageCombination-logs in your user folder. The button Show log in the bottom bar shows the log; there you choose another folder with Choose folder ... (applies from the next start) or the default with Default. The log is purely diagnostic and never disturbs the script.
  • Remembered in the PixInsight settings: language, theme, own templates and the log folder (keys AoP_ImageCombination/language, /theme, /templates, /logDir).

6. Common problems and solutions

  • "Images are not the same size" / image is rejected: bring all images to the same pixel size (crop and register them the same way).
  • Red placeholder layer, result cannot be computed: click the placeholder and choose an open image, or delete it with X.
  • A quick template does not find an image: the image name has no recognised channel name. Rename the image (e.g. NGC7000_Ha) or fill the placeholder by hand.
  • Preview is black or very dark: the image is linear. Switch Auto-stretch on.
  • Mask has no effect: check that the layer row says "Mask", that the mask image is the same size and, for "greyscale mask image", really a greyscale image. With mean, maximum, minimum, median the bottom layer has no mask.
  • "Replace target with combination" reports an error: the target must be the same size and a colour image for a colour result.
  • "Switch to original resolution" is slow: normal for large images. For judging detail "Section 1:1" is enough.
  • After an update the menu entry is missing or the old one stays: Script > Feature Scripts > Regenerate.

7. Limits and known quirks

  • All layers must be the same size. The script does not register or rescale.
  • The preview is reduced; judge fine differences (e.g. the mask blur in pixels) with "Section 1:1".
  • PixelMath clips the result at 0 and 1, unless the exposure restores values beforehand.
  • Progress inside a long PixelMath calculation is not visible.
  • The script is vibe-coded software: it is tested with a test harness outside PixInsight. Back up your original before overwriting an image (target).

8. Change log

  • v0.16.1 (21 Nov 2026) Fixed messages in the Process Console at start (duplicate text entries, return values, position calculation). Buttons no longer take keyboard focus (against a dot pattern inside buttons).
  • v0.16.0 (21 Nov 2026) No fixed PC path any more: log folder in the user folder by default, can be changed in the log window. Header comment and version aligned, licence line. Release folder with release.json and this manual.
  • v0.15.x (20/21 Nov 2026) Mask on every layer (the displayed mask image applies to the layer), mask in red over the image in the preview, layer rows of fixed width, new arrangement of the right column (background, white balance with preview selection, exposure), sliders in pairs, dark violet title bars, countermeasures against a dot pattern after "Switch to original resolution".
  • v0.14 and earlier Language switch German/English, AoP/PI theme, SCNR, exposure, white balance, matching (LinearFit), histogram, magnifier, quick templates, own templates, masks, log.

9. Author and licence

Script by Thomas ArtOfPix Großschmidt · Vibecoding with ClaudeAI.

Free of charge, without warranty and without liability. Redistribution only unchanged and with attribution.

Licence and liability

Free to use, without warranty and without liability: I accept no liability for damage or data loss. Redistribution only unmodified and with attribution (Script by Thomas ArtOfPix Großschmidt · Vibecoding with ClaudeAI). All other rights remain with me. This is not an open-source licence. For bugs or wishes please write to me via the contact page.

Checksum (SHA-256) of the ZIP file: c9c5103cda45f45cd5b486823a24a001116cbcdac80defc3959214b3b507c9e9

← Scripts