Avenyora reflection
Astrophotography Flat Frames: Fix Vignetting and Dust Shadows
Capture flat frames that match your target exposures, avoid clipped pixels and catch overcorrection before stacking.

Flat frames correct the dim corners and dust shadows that repeat in astrophotography images. They record how your camera and optics respond to an evenly lit field. To make useful flats, keep the camera angle, focus and filter as they were for the target exposures, and record an evenly illuminated source without clipping the bright pixels. Calibrate and combine the flats, then use the resulting master flat on the original target frames before aligning and stacking them.
A flat can go wrong even when it looks smooth. The important checks are whether it records the same optical pattern as the target images and whether its brightness is in a range the detector measures reliably. One test exposure and a comparison on a single target frame can reveal either problem before you process the whole session.
What a flat measures
A flat frame should show about the same incoming illumination across the optical field. Differences in the recorded brightness then tell you something about the setup. A filter or lens barrel may reduce the light reaching the corners. Dust near the sensor can leave a soft shadow. Even pixels receiving equal amounts of light can respond a little differently. The Siril calibration documentation describes these effects and how software uses a master flat to correct them.
Say an evenly illuminated test gives 20,000 counts in a reference region and 15,000 in a corner after the relevant camera offsets are removed. Relative to the reference, the corner response is 15,000 divided by 20,000, or 0.75. If a target frame records 675 corrected counts from the same corner, dividing by 0.75 gives 900. A patch with the same true brightness in the reference region would already have measured 900 in this example. The real calculation works across the image with a master flat normalized to a representative level. Individual pixel values can still have noise. A flat estimates the systematic difference in response.
The correction restores the expected brightness scale. It cannot supply photons that were blocked. A strongly vignetted corner still collected less signal and can look noisier after correction. Inspect both the appearance of the field and the noise before deciding whether to crop any edges.
What must match the target frames
Keep the imaging train assembled until the flats are done. Use the same filter, camera orientation and focus position, because changing any of them can move a dust shadow or change how the corners are illuminated. If a filter wheel was used for several filters, make and label a set for each filter. If you removed the camera or turned a rotator during the night, treat the two configurations separately if the change moved the pattern. Celestron's guide to calibration frames describes why preserving the setup matters for flats.
Use a raw or otherwise linear recording format. Preserve the image dimensions, sensor region and binning used for the target exposures. Match gain, offset or ISO and readout mode as required by the camera and the calibration workflow, particularly for the files used to calibrate the flats themselves. Changing binning can change how pixels in one frame correspond to pixels in another. The pixel scale guide explains how a change in pixel sampling also affects the piece of sky represented by each output pixel.
The exposure length of a flat is usually different from that of a target frame. Its job is to put a good signal on the sensor with the chosen illumination. For example, a flat for a narrowband filter may need a different exposure from one for a broadband filter even if both were taken with the same panel.
How to judge a test flat
Aim the instrument at an evenly illuminated source appropriate to the setup, such as a diffuse flat panel. Look at a raw test exposure. A preview stretch can make a dim frame look bright, so inspect the linear histogram or pixel statistics. Keep the brightest usable pixels below saturation and within the sensor's linear range. Check all channels on a colour camera if your software can show them. A dominant peak can be well placed while one channel clips.
A very short exposure can reveal bands from a flickering panel or a shutter pattern on some cameras. Compare a few frames and look for structures that change between them. If the source is uneven or the exposure introduces bands, try a more uniform source or a less intense setting that lets you expose longer without clipping. There is no single ideal histogram percentage for every sensor and mode. A set of good exposures lets the combination reduce random noise in the flat itself.
How a flat becomes a master
A raw flat includes the illumination pattern and the camera's additive offset. Depending on the sensor and exposure, it can also contain measurable dark signal. The flat workflow must account for these contributions before normalising or combining the flats as the software expects. A matched dark flat is taken in darkness at the flat exposure and corresponding camera settings. It ordinarily already contains the electronic bias. If the workflow subtracts that unmodified dark flat, subtracting another full bias for the same signal would count it twice. Other workflows account for bias separately and handle dark current according to the sensor and exposure. The Astropy calibration guide explains the distinction between a matched dark and one scaled to a different exposure.
Apply the finished master in the workflow that calibrates target exposures, before the frames are shifted to line up on stars. This keeps the recorded dust and illumination pattern in the same detector coordinates. The guide to stacking short and long exposures covers what happens once the individual exposures are ready to combine.
How to spot a mismatch before stacking
Calibrate one representative target frame and compare it with the same frame processed without the flat. Use the same display stretch for both. If a dark dust ring turns bright, the flat may be applying too much correction there. If you see a bright ring next to a dark one, compare where the shadows sit in the master and the target. A shifted shadow can produce both. If the corners become too bright, review the filter and camera setup, the flat illumination and the bias or dark-flat correction.
A broad gradient from moonlight or light pollution can remain after a good flat. It comes from the sky rather than a fixed change in the optical response. Moisture can change the optics during an imaging run, too. When halos grow from one exposure to the next, inspect the equipment for dew on the optics. A single flat cannot reliably describe a pattern that changed during the run.
Frequently asked questions
Can I take flat frames the next morning?
Yes, if you can preserve the optical setup and the relevant camera settings and obtain even illumination. A camera or filter change can make a new set necessary.
Do flats need the same exposure time as my target frames?
Flats need enough light for a clean measurement in the detector's linear range. Their exposure length usually differs from the target's. A matched dark flat uses the same exposure length as the flat it calibrates.
Can flat frames remove light pollution?
They correct a fixed response pattern in the imaging system. A gradient from the sky can remain and needs separate treatment.
Why did my dust rings get brighter after calibration?
A bright ring can mean the master flat compensated for a shadow that was stronger or in a different place than in the target. Check for a change in filter, focus or camera orientation, and verify the flat calibration.