Linear vs Stretched: Why Your Stacked File Looks Black - or Green

A stacked astrophoto opened in an ordinary viewer is black or green. What 'linear' means, why stacks are saved as 32-bit float, and why a stretched preview cannot be processed like a stack.

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 refuses to fix it.

All three come from the same idea: 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. A stack of those counts, averaged, keeps that property - 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-is, a linear stack is black with white pinpricks. That is not underexposure: it is simply 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 - removing a gradient, balancing colour, measuring noise, removing stars - assumes linear data. Done after a stretch, it is solving a different problem from the one in the sky.

Why a colour stack is green

A one-shot-colour camera has twice as many green pixels as red or blue, and green is where it is most sensitive, so a raw colour stack leans hard toward green. Stretch it without calibrating the colour first and the green is lifted along with everything else. Why your stacked image is green covers this properly; the short version is that 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 - 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. It is why stackers save FITS or float TIFF: it is the format that can hold a stack.

It is also a useful signal. A finished picture is almost always 8- or 16-bit integer; 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 exactly that reason, and when a float still is opened again it is treated as a stack: gradient removed, colour 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. The honest thing for a program to do is treat it as a finished picture - which 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 - 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; reprocessing the original frames is the fix.

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 does everything in this guide automatically, and tells you what it did.

Download Akastroid - free