Fundamentals · PixInsight 1.9.x

PixelMath

PixelMath applies a formula to every pixel. Images are referenced by their IDs. This lets you combine channels into colour images, blend images or recombine stars with a screen blend.

Purpose

TaskExample
combine channels into a colour imageHOO, SHO
build or blend luminancesmaximum or weighted sum
recombine starsscreen formula
subtract signalcontinuum subtraction

Principle

  • An expression such as L * 0.6 + Ha * 0.4 is evaluated for every pixel; image names stand for the pixel values of that image (values 0–1).
  • Important operators and functions: + − * /, max(), min(), med() (median of an image), ~x (inversion, 1 − x).
  • All images involved must have the same dimensions.

Parameters

SectionEffectTypical choice
RGB/K expressionone formula for all channelsUse single RGB/K expression enabled when all channels are treated alike
R / G / Bseparate formulas per channelfor colour combinations
Symbolsvariables, e.g. s = 1.0for adjustable factors
DestinationReplace target image or Create new image (with ID, colour space)see below
Rescale resultnormalises the result to 0–1usually off

Operation

  1. Enter the expression, replace image IDs with the actual names.
  2. Choose the destination; for Create new image set ID and colour space (RGB or greyscale).
  3. Apply to the target image (drag the triangle onto it) or execute globally.

Typical applications

Narrowband palettes

Create new image, colour space RGB.

PaletteRGB
HOOHaOIIIOIII
HOO with blendHaHa*0.3 + OIII*0.7OIII
SHOSIIHaOIII
  • OIII emits at 496/501 nm, between green and blue; in G and B it gives the perceptually natural teal. A share of Ha in G (0.2–0.4) shifts Ha areas towards yellow/orange and creates more natural transitions; higher shares weaken the separation.
  • SHO is strongly greenish at first (Ha in G); the palette only emerges with .
  • For SHO, ChannelCombination is sufficient too (R = SII, G = Ha, B = OIII).

Building or blending a luminance

PurposeExpression
each structure from the brightest channelmax(A, B_LF)
softer, less noisyA*0.6 + B_LF*0.4 (weights sum to 1)
blend luminance with the colour image’s L*Luminance * 0.7 + ColourImage_L * 0.3

Match levels first: .

Recombining stars

~((~Starless) * (~(Stars * s)))
Symbols: s = 1.0

Screen blend 1 − (1 − a)·(1 − b); destination Replace target image on a duplicate. Details: .

Subtracting the continuum

Ha - q * (R - med(R))

Removes stars and continuum from an Ha image by subtracting the red channel; q matches the signal strengths. Works only if stars have the same profile in both images: .

What a good result looks like

Typical errors

ObservationCauseRemedy
Error “unknown symbol”image ID misspelledcheck IDs
Result black or whiterescale or value rangerescale off, check the expression
Astrometric solution missingCreate new imageReplace target image on a duplicate
max() always picks the same channellevels not matchedLinearFit first
Grey result instead of a colour imagecolour space greyscalecolour space RGB

When to use it – and when not

Good forBetter another tool
any pixel-by-pixel calculationsimple channel combination → ChannelCombination
palettes, luminances, screen recombinationcombining luminance and colour image →
Used in

HaLRGB workflow · Narrowband workflow (HOO/SHO) · OSC workflow with a quad band-pass filter · Synthetic luminance