---
UPDATE (16 May 2026) — please read before responding:
The framing I should have started with: this post is about two different ways to remove background gradients — doing it before stacking (per individual exposure) versus after stacking (on the final master).
Why this matters: A single exposure usually has a simple gradient — light pollution from one direction, a vignette ring, an atmospheric brightness slope. When many exposures with slightly different framing and rotation are stacked, those simple gradients combine into a more complex pattern in the final master. The stacking step itself can turn easy-to-fix gradients into harder-to-fix combined patterns.
- Post-stack tools (GraXpert, AutoDBE, GC, MARS) work on the integrated master after stacking. They model whatever pattern ended up there. Works well when the field has clearly empty sky to use as reference.
- Pre-stack (this pipeline) works on each exposure individually, before integration. Catches gradients while they're still simple, and works even when the final stack has no empty sky regions.
Where pre-stack demonstrably helps:
- Faint structures become more visible. Pre-stack gives a cleaner background floor, which lets you stretch the image more aggressively to bring out galaxy halos, tidal features, faint IFN — without the background going "blotchy" alongside the signal. On dense Hα fields like NGC 6888, pre-stack achieves the best combination of low background noise plus preserved diffuse nebula structure. It's the only method tested where faint structures end up ~21% more visible than in the no-BG baseline; post-stack tools at default cut more of the per-pixel signal alongside the BG, ending up between −4% and −25% in net visibility on this regime. On cleaner Coma-class galaxy fields, post-stack tools at default work similarly well — the pre-stack advantage shows up specifically when fields are crowded with diffuse signal.
- Heavily light-polluted data (Bortle 7-8 LP + vignette + moon): pre-stack achieves ~4× less residual gradient than the best post-stack tool at default (controlled test with synthetic gradient injection earlier in this thread).
- Dense narrowband nebula fields (NGC 6888 in Cygnus, suggested by @Wei-Hao Wang as a stress test): all gradient removal methods reduce the real diffuse Hα emission to some degree, but pre-stack loses noticeably less of it (~10% per pixel) than post-stack tools at default (20-35%). The diffuse structure is independently confirmed by professional surveys (IPHAS DR2 and Stefan Ziegenbalg's Northern Sky Narrowband Survey) — pre-stack matches those references better.
Where it doesn't help much: dark-sky data with weak gradients, or isolated galaxy targets — any tool at default works fine.
Retractions from earlier in the thread: "+0.7-1.2 mag deeper" and "8-14× flatter" — both were against the no-BG baseline, not against actual gradient-removal tools. @andrea tasselli and others correctly flagged this as apples-to-bananas. The advantage of pre-stack vs proper BG tools is real at stressed conditions and dense fields, marginal at clean ones.
Pre-stack as part of a toolbox, not a replacement:
- Pre-stack as an architecture isn't tied to this specific implementation. Any of the existing tools — GraXpert, AutoDBE, GC, MARS — can in principle be applied per-sub before stacking, instead of (or in addition to) the integrated master. The pipeline position is what creates the architectural advantage, not the specific algorithm. ABYSS is one implementation (wavelet-based BG modeling, Borlaff+2019 style) showing the principle works; running existing tools per-sub would give similar architectural benefits with their respective algorithmic tradeoffs. The methodologically interesting point is "before vs after stacking", not "my tool vs your tool".
- Post-stack workflow (applying tools to the integrated master) covers most amateur use cases well at default settings.
- MARS (Vicent Peris, PixInsight) is the architecturally cleanest post-stack approach for difficult fields — it automates what @Wei-Hao Wang has been doing manually for two decades (taking a wider-field reference image first).
- Pre-stack is a complementary architecture for harder cases (heavy LP, dense nebula fields), not a universal replacement.
Original post text below remains for context with existing replies.
---
Hi all,
Over the past months I've been developing a custom reduction pipeline focused on background gradient removal. The motivation was simple: I wanted to stretch faint structures (galaxy halos, tidal features, IFN) more aggressively without amplifying background gradients or other artifacts.
Existing tools didn't quite get me there. I find DBE tedious and error-prone in practice — manual sample placement is a lot of work and easy to get wrong, especially around large galaxies or extended nebulosity. GraXpert and multiscale gradient tools are faster but often don't give me the result I want, and it's hard to understand why the algorithm decided what it decided. And none of them address the per-sub flat-fielding stage where many gradient problems originate.
So I built something based on the ABYSS approach from professional deep imaging surveys (Borlaff et al. 2019, A&A 621, A133): multi-pass background fitting with source-masked sky flats per sub, conservative gradient removal designed to preserve extended low-surface-brightness signal. Implementation with GPU acceleration.
The practical result: backgrounds are flat enough that aggressive stretching no longer reveals processing artifacts. Faint structures survive the background fit instead of being subtracted with it.
Comparison images — Pipeline vs PixInsight WBPP on identical subs:
📷 Coma_Abyss.jpg
📷 Coma_Wbpp.jpg
The Coma Cluster comparison shows the most striking visual difference — hundreds of cluster member galaxies that are barely visible in the WBPP output emerge cleanly in the pipeline output, along with faint diffuse signal in the cluster core consistent with intracluster light reported in deep imaging surveys.
📷 M65_Abyss.jpg
📷 M65_Wbpp.jpg
The Leo Triplet output shows similar improvements with documented structures — the NGC 3628 stellar halo and southern tidal plume are clearly visible in the pipeline output but not in WBPP at identical stretch.
Both comparisons use the same calibrated subs after identical quality filtering. Stretching applied identically. No BXT, NXT, or any post-processing on either side — what you see is the stack output directly.
Quantitative summary:
5σ detection depth: +0.7 to +1.2 mag deeper than WBPP (Gaia DR3 photometric calibration)
Background spread: 8-14× flatter
For Leo Triplet: 95% of the pipeline's additional detections have a direct PanSTARRS DR1 counterpart, confirming they're real sources rather than artifacts
Pipeline tested with pure-noise input (no spurious structures created) and mock-source injection (correct faint-source recovery)
Setup: SkyWatcher Esprit 120ED, QHY268M Mono, Bortle 5 skies. Coma: 432 ×120s subs. Leo Triplet: 376×120s L after quality filtering.
For now I'd genuinely appreciate critical feedback. Especially:
Anyone seeing issues in the comparison images I'm missing?
Suggestions for additional validation targets ?
Experiences with similar approaches?
Happy to discuss methodology in the thread.
Clear skies, Dirk

