How to Open and Stretch FITS Astronomy Images
FITS files from telescopes look black until stretched. Learn how FITS works and how to stretch, read headers, debayer and build RGB images in the browser.

How to Open and Stretch FITS Astronomy Images
Whether you download a frame from a space telescope archive or capture your own with an astro camera, the image arrives as a FITS file. Double-click it and most computers have no idea what to do. Open it in a general image program and it may look entirely black. This guide explains why and shows how to get a good look with the free FITS Astronomy Image Viewer, which works in your browser.
What FITS is
FITS, the Flexible Image Transport System, has been the standard of astronomy since 1981. A file has one or more units, each with a header and data. The header is plain text in cards of exactly 80 characters, such as EXPTIME = 300 or FILTER = 'Ha'. Then come the pixels, stored as 8, 16, 32 or 64-bit integers or as 32 or 64-bit floating-point numbers. Two cards, BSCALE and BZERO, convert stored values to real ones; that is how 16-bit cameras store values from 0 to 65,535 in signed integers.
Some files contain several images, for example a calibrated frame plus an error map, or a cube with many planes from a spectrograph. The viewer lists every image unit and every plane so you can pick the one you want.
Why stretching matters
A sky image holds faint nebulosity a few counts above the background and stars thousands of times brighter. Mapped straight to the 256 grey levels of a screen, almost everything falls into the darkest few levels. A stretch fixes this by choosing a black point and a white point and a curve between them.
The viewer sets the points as percentiles of the pixel values, which works whatever the data range. The Auto preset clips the darkest 0.5 percent and the brightest 0.3 percent. Faint pulls the black point up and the white point higher for dusty nebulae. Full range shows everything, which is useful for checking saturation. Planet keeps detail on bright discs.
Then choose the curve. Linear keeps brightness proportional. Square root and log lift the faint parts. Asinh behaves linearly near the black point and logarithmically for bright values, so star cores stay round while faint structure appears; it is a good default. Histogram equalisation spreads the values evenly and reveals every structure, at the price of a less natural look. The histogram below the image marks the black and white points so you can see what is being clipped.
Reading the header
Every card is listed with its value and comment. Search for EXPTIME, GAIN, CCD-TEMP, FILTER, OBJECT, DATE-OBS or any other keyword. This is often the fastest way to confirm what a file is before stacking, or to check that a set of frames used the same settings.
Colour from colour cameras
One-shot colour cameras record through a mosaic of red, green and blue filters over the pixels, called a Bayer pattern. The raw frame looks like a grey checkerboard. If the header has a BAYERPAT card, the Debayer button combines each block of four pixels into one colour pixel. If the card is missing, try RGGB, the most common pattern.
Colour from filter frames
Monochrome cameras shoot each colour through a separate filter. Open the three frames, switch to RGB stack and assign them to red, green and blue. Each channel has its own stretch, which lets you balance the colours. The same works with narrowband data, for example hydrogen alpha in red, oxygen III in green and blue, or with three planes of a cube.
Exporting
PNG and 8-bit RGB TIFF save what you see. The 16-bit greyscale TIFF keeps the linear values between your black and white points with 65,536 levels, ready for editing in other software.
Limits
The viewer does not stack many frames, apply darks and flats, plate solve or show sky coordinates, and tile-compressed .fz files must be uncompressed first. For inspecting a capture, checking headers, previewing a calibrated frame or making a quick colour image from three filters, it gives you a clear picture without installing anything, and the data stays on your machine.


&c=%237c3aed&k=images)
