Linear vs Stretched: Why Your Stacked File Looks Black or Green
A stacked astrophoto opened in an ordinary viewer is black or green.
You save the stacked image, open it in Preview or Photos, and it is black: a few white dots on nothing. Or you open it in your processing program and it is a flat, lurid green. Or you open a saved picture in your processing program and it treats it as finished and will not fix it.
All three come from the difference between linear and stretched data.
Linear: the light as it was counted
A camera sensor counts photons. Twice the light, twice the number. An averaged stack of those counts keeps that property, so pixel values are proportional to the light that arrived. That is linear data.
In linear data the sky and the faint nebula sit in the bottom one or two percent of the range. The brightest star cores are near the top, and almost nothing is in between. Displayed as it is, a linear stack is black with white pinpricks. That is not underexposure. It is how dim a deep-sky target is next to a star.
Stretched: made for eyes
To be seen, the image is stretched. A curve lifts the faint end enormously and compresses the bright end, so the sky rises from 1% to a tenth of the range and the nebula becomes visible. After a stretch, values are no longer proportional to light; doubling the light no longer doubles the pixel.
Most processing steps (removing a gradient, balancing color, measuring noise, removing stars) assume linear data. Done after a stretch, they are working on a different problem from the one in the sky.
Why a color stack is green
A one-shot-color camera has twice as many green pixels as red or blue, and green is where it is most sensitive, so a raw color stack leans hard toward green. Stretch it without calibrating the color first and the green is lifted along with everything else. Why your stacked image is green covers this properly. In short, the green is real, and removing it is a calibration step that belongs on the linear data.
Why stacks are saved as 32-bit float
A 16-bit integer file has 65,536 levels. In a linear stack the sky and the faint nebula live in roughly the bottom thousand of them, which is a coarse ladder for the part of the picture you care most about. Stacking many frames produces finer steps than any single frame had, and 16-bit integers round that precision away.
A 32-bit floating-point file keeps every fraction the stack produced. That is why stackers save FITS or float TIFF.
It is also a useful clue. A finished picture is almost always 8- or 16-bit integer, and a float file is almost always a stack. Akastroid’s Save the stacked image writes the stack as 32-bit float TIFF (or FITS) for that reason, and when a float still is opened again it is treated as a stack: gradient removed, color calibrated, stretched.
A stretched preview is not a stack
Programs show you a stretched preview of the stack so you can see it. Save that preview and you have saved a picture, not data. The sky has already been lifted, the green is baked in, and the counts are gone. Opened again, it cannot be un-stretched, and the right thing for a program to do is treat it as a finished picture. That is why “fixing” a saved preview never works as well as reprocessing the stack.
Up to version 1.3.1, Akastroid’s Save the stacked image wrote that stretched preview, which was a bug. From 1.3.2 it writes the linear stack. A file saved by an earlier version is a preview and will open as one; reprocess the original frames instead.
How to tell which you have
- Opens black with white dots in a normal viewer: linear.
- Opens with a visible sky and nebula: stretched.
- FITS, or TIFF/XISF with 32-bit float samples: almost certainly linear.
- JPEG or PNG: stretched, always.
The short version
- Linear data is proportional to light. It looks black, and it is what processing works on.
- A stretch makes it visible and ends its linearity. Calibrate before stretching, never after.
- Save stacks as 32-bit float (FITS or float TIFF). 16-bit throws the faint end away.
- A saved preview is a picture, not a stack, and cannot be reprocessed as one.
Also in Deutsch · Español · Français · Italiano · 日本語 · Nederlands · Polski · Português (Brasil) · Türkçe · 繁體中文
Try it on your own data
Akastroid runs its processing on your own frames and logs each step it took.
Download Akastroid