Function: Star Stretch - setiastro/setiastrosuitepro GitHub Wiki

Function: Star Stretch

Midtones-transfer stretch with analytic continuation, tuned to lift nebulae while protecting star cores and preserving color. GPU/Numba kernels are used when available; a safe NumPy path is used otherwise. Non-destructive preview; Apply commits with undo.


Tone curve

The tone mapping belongs to the midtones family:

f_a(x) = \frac{3^{a}\,x}{\left(3^{a}-1\right)x + 1}, \qquad x\in[0,1].

Here (a) is a continuous strength parameter—the analytic continuation of applying the midtones operator repeatedly. It is monotone, gives a gentle lift to mid-tones, and compresses highlights smoothly (star-friendly). (This is not arcsinh.)


Controls (UI)

  • Stretch Amount (a\in[0,8]) Directly sets the exponent in (3^{a}) above. Higher values lift mid-tones more while keeping bright star cores controlled.

  • Color Boost (saturation scale (s\in[0,2])) Applies a light saturation around the per-pixel mean:

    \text{RGB}' \;=\; \overline{C} + s\,\big(\text{RGB}-\overline{C}\big),
    \qquad \overline{C}=\tfrac{R+G+B}{3}.
    
  • SCNR (Remove Green) Optional green suppression (Average-Neutral variant) to tame green casts.


Mask-aware blend

If a mask (m\in[0,1]) is active, the stretched result is blended with the source:

I_{\text{final}} \;=\; m\,I_{\text{stretched}} + (1-m)\,I_{\text{source}}.

The mask is auto-resampled to the image size; mono/RGB cases are handled transparently.


Preview & Navigation

  • Background thread computes previews.
  • Zoom In/Out, Fit to Preview; Ctrl+Wheel to zoom at cursor; drag to pan.
  • Preview is non-destructive; Apply to Document records a history step with parameters (stretch amount, color boost, SCNR on/off, mask info).

Tips

  • Start with (a\approx 4!-!6) for typical linear stacks; raise slowly until nebula detail appears without blowing star cores.
  • Add a small Color Boost (e.g., (s=1.1!-!1.3)) after stretching to restore perceived color.
  • If you see green cast from filters/sensors, toggle SCNR.
  • For exact median targeting, use Statistical Stretch; Star Stretch is for quick, star-friendly lifting using the same midtones family.