Fundamentals · PixInsight 1.9.x

GeneralizedHyperbolicStretch (GHS)

GeneralizedHyperbolicStretch (GHS) turns linear data into a visible image. Unlike a fixed curve, GHS lets you decide around which brightness value contrast grows most, and limits the stretch below and above it.

Purpose

TaskSetting
turn linear data into a non-linear imageinitial stretch, SP on the background
darken the background without losing informationTransformation type Linear, Blackpoint
stretch a colour image without fading coloursMode Colour
WhyGHS rather than a single histogram stretch?

A HistogramTransformation lifts all tonal values with one fixed curve. GHS sets the range of strongest contrast gain (SP) freely and limits the stretch above (HP) and below (LP). Contrast is created exactly where the faint structures lie, without blowing out stars. Several small passes are easier to control than one large one, because you measure again after each.

Principle

  • With a positive stretch (D > 0) the curve lies above the diagonal along its whole length: every value is raised, including the background. The background peak moves to the right.
  • GHS only stretches; the black point stays at 0. Afterwards the background floats at a mid grey and the tonal range to its left stays empty – the image looks milky. SP and LP do not change this.
  • A black point alone darkens the background but drags faint structures down with it as long as they are still close to the background.
  • Hence the principle: alternate stretch and black point. The stretch pulls structure and background apart, the black point brings the background back down. Each repetition increases the distance.
  • The auto-STF looks more contrasty than a pure GHS pass because it combines stretch and black point (approx. median − 2.8 × MAD).

Parameters

ParameterShortEffectTypical choice
Stretch factor (ln(D+1))Dstrength of the stretch per passhigh for the initial stretch (linear background very dark), smaller later for finer control
Local intensitybconcentration of contrast around SP; higher = more targetedhigh for the initial stretch, lower later for an even lift
Symmetry pointSPvalue around which contrast grows moston the background peak – structure just above receives the most contrast
Protect shadowsLPno additional contrast below itprevents amplified noise below the background; does not prevent the background from brightening
Protect highlightsHPlimits the stretch above itprotects star cores and bright areas from clipping

Operation

  • Make a copy first; the linear original remains as a fallback.
  • Enable the Real-Time Preview and reset the STF of the main image (Ctrl+F12). Otherwise the preview inherits the STF and stretches on top.
  • The image must be 32-bit floating point (status bar of the main window: f32). In 16 bits a linear background of 0.0001 would have only a few levels – stretching creates posterisation. The preview shows its own format (e.g. i16), not that of the image.

Measuring values

  1. In the main image enable auto-STF (Ctrl+A) – it changes only the display, not the pixel values.
  2. With GHS open, click the spot with the left mouse button held down; values appear under Readout Data.
  3. Send to SP transfers the value. LP has no button of its own: enter the value or select LP under Fine adjustment.
  4. Reset the STF of the main image again.
  • For a stable value use Edit → Readout Options: Probe size 9×9 or 15×15, Mean or Median, Apply Global. The median is more robust if a faint star lies in the probe area.
  • Alternatively click the background peak in the GHS graph (zoom the graph; in a linear image the peak is at the far left).
  • The peak moves right with each pass → measure again before every pass.

Typical applications

Initial stretch in cycles

1  Initial stretch (1–2 passes)         SP = background, LP = 0
        ↓
2  Black point (Linear)                 up to just before the left foot of the peak
        ↓
3  Measure SP again, stretch            SP = background, LP just below SP
        ↓
4  Black point (Linear)                 small step
        ↓
   repeat 3–4 until structure is clearly separated and background is dark
StepTransformation typeDbSPLPHP
1 Initial stretchGeneralised Hyperbolic2–44–8background01.0
2 Black pointLinear–––––
3 StretchGeneralised Hyperbolic1–32–4background (new)just below SP0.95–1.0
4 Black pointLinear–––––
WhyLP just below SP from the second pass on?

After the first black point, only noise and the darkest structures lie below the background. LP prevents this range from gaining more contrast – and visible noise – with every pass. LP must never be above SP.

  • With a very dark linear background (median around 10⁻⁴) the initial stretch needs several passes.
  • Contrast passes with SP on faint structure are usually not useful: SP and background are too close, the background brightens as well, and stars bloat. Local contrast is better built later with or .

Setting the black point

  1. Transformation type: Linear.
  2. Raise Blackpoint at most to just left of the left foot of the histogram peak, never up to the peak.
  3. Check in the preview: background darker, faint structures still visible.
Whyonly up to the foot?

Left of the foot there is only noise and very few pixels; a black point there costs no information. At the peak, half of the background would be clipped.

  • Do not clip: no pile of pixels at zero on the left. Clipped pixels are lost.
  • Alternative: HistogramTransformation, shadows slider; the dialog shows the share of clipped pixels – stay below about 0.01–0.05 %.
  • Intermediate black points may be strong, the last one gentle: it decides how much room the dark areas keep in the final image.

Colour images: Colour mode

Section Colour Options:

ElementFunction
ModeRGB: each channel independently – colours fade. Colour: all channels of a pixel in the same ratio – saturation is kept
Clip typehandling of values above 1; default RGBBlend
Colour blend1.000 = pure Colour mode, lower values mix in RGB
Use RGB working spaceweights by the luminance coefficients of the working space

Setting: Mode Colour, Colour blend 1.000, Use RGB working space enabled – check before every pass. Irrelevant for monochrome images.

WhyColour mode?

A stretch is a non-linear curve. Applied to each channel separately, it changes the channel ratios of a pixel: the darkest channel is raised most in relative terms and all colours drift towards grey. In Colour mode a weighted average is stretched and every channel is scaled by the same factor – the colour is preserved. Use RGB working space weights by brightness sensitivity (green more strongly), so the stretch follows perceived brightness.

Monochrome images: applying the auto-STF

Quick alternative without GHS:

  1. Linear image, auto-STF (Ctrl+A).
  2. Drag the STF triangle onto the bottom bar of HistogramTransformation.
  3. Reset the STF (Ctrl+F12), apply HistogramTransformation.

Greyscale images only: the auto-STF stretches each channel separately and would reduce saturation in colour images. It places the background rather bright (around 0.25); if needed, a small black point step.

What a good result looks like

Typical errors

ObservationCauseRemedy
Stars clipped, bloatedHP too high, D too largelower HP, reduce D per pass
Background milky, flatblack point missingpass with Linear and Blackpoint
Structure disappears after the black pointstructure still too close to the backgroundundo the black point, stretch further, then try again
Colours paleMode RGBMode Colour with Use RGB working space
Structure flattoo few cyclesanother cycle of stretch + black point
Posterisation, tonal breaksimage in 16 bitsconvert to 32-bit floating point, stretch again
Preview looks too brightSTF active in the main imageCtrl+F12

When to use it – and when not

Good forBetter another tool
stretching linear data in a controlled wayquick greyscale stretch → auto-STF via HistogramTransformation
darkening the background without clippingmatching tonal ranges in a non-linear image →
stretching a colour image while keeping saturationlocal contrast →
Used in

CurvesTransformation · HaLRGB workflow · Narrowband workflow (HOO/SHO) · OSC workflow with a quad band-pass filter · StarXTerminator (SXT)