Dark frame subtraction is a calibration technique that removes repeatable sensor artifacts from an image by subtracting a dark frame, an exposure taken with no light reaching the sensor but with the same exposure time, ISO and temperature as the original. In photography it is a core tool for protecting image quality in long exposures, where thermal signal, hot pixels and amp glow become visible. Many cameras offer it as long exposure noise reduction.
The method targets only the fixed, predictable part of the noise. It cannot remove random noise such as shot noise or most read noise, and if done carelessly it can even add random noise to the final image.
How dark frame subtraction works
Every sensor pixel accumulates a small charge even in complete darkness. This dark current comes from thermally generated electrons, and its amount differs from pixel to pixel because of manufacturing variations. Over a long exposure these differences produce a fixed pattern of bright pixels and gradients that appears in the same place in every frame taken under the same conditions.
A dark frame records exactly this pattern without any scene content. Subtracting it pixel by pixel from the light frame removes the repeatable component, leaving the scene plus the random noise of both exposures. The subtraction must happen on linear raw data before demosaicing, white balance and tone curves, which is why cameras do it internally and why astrophotography software applies it at the calibration stage.
The table below lists the artifacts that a dark frame can and cannot correct.
| Artifact | Origin | Removed by subtraction |
|---|---|---|
| Hot pixels | Pixels with unusually high dark current | Yes, if temperature matches |
| Amp glow | Heat or light from readout circuitry | Yes, largely |
| Thermal gradient | Uneven sensor temperature | Yes, if stable between frames |
| Shot noise | Random arrival of photons | No |
| Random read noise | Readout electronics | No, it increases |
| Sensor dust and vignetting | Optical path | No, requires flat frames |
Parameters that determine success
A dark frame is useful only when it reproduces the same dark signal as the light frame. The decisive variables are exposure time, gain and sensor temperature. Dark current in typical silicon sensors roughly doubles for every 5 to 7 degrees Celsius of temperature rise, so even modest warming during a night session can make a dark frame mismatched.
| Parameter | Matching requirement | Effect of mismatch |
|---|---|---|
| Exposure time | Identical to the light frame | Under- or overcorrection of hot pixels |
| ISO or gain | Identical setting | Pattern scaled incorrectly |
| Sensor temperature | Within about 1 to 2 degrees Celsius | Residual hot pixels or dark holes |
| Offset or black level | Same camera mode and firmware | Shifted background level |
| Light leakage | Fully sealed lens or body cap | Scene light contaminates the dark |
Overcorrection produces dark holes where hot pixels used to be, while undercorrection leaves faint residual hot pixels. Both are signs that the dark frame and the light frame were recorded under different conditions.
In-camera noise reduction versus master darks
Cameras implement dark frame subtraction as long exposure noise reduction: after a long exposure, the camera immediately records a dark frame of equal length and subtracts it. This guarantees near-perfect temperature matching but doubles the total capture time, which is a serious drawback when shooting star trails or time-lapse sequences.
Astrophotographers usually prefer a master dark, made by averaging many individual dark frames. A single dark frame contains its own random noise, so subtracting it raises random noise by a factor of about 1.41. Averaging N dark frames reduces that penalty to the square root of 1 plus 1 divided by N, so 20 to 50 darks make the added noise nearly negligible.
| Strategy | Main advantage | Main drawback |
|---|---|---|
| In-camera single dark | Automatic, temperature matched | Doubles time, adds random noise |
| Averaged master dark | Minimal added noise | Temperature matching is harder |
| Dark library | Reusable across sessions | Needs cooled camera or temperature records |
| Scaled dark with bias | Adapts to different exposure times | More complex processing |
| Dithering without darks | Rejects hot pixels statistically | Requires many frames and a tracking mount |
In full astrophotography calibration, darks work together with bias frames, which capture the readout offset, and flat frames, which correct vignetting and dust. Each calibration frame addresses a different error, and none can replace the others.
When dark frame subtraction is worth using
The benefit grows with exposure length and sensor temperature. Modern sensors with low dark current may show few artifacts below about 30 seconds, whereas multi-minute exposures on a warm summer night often reveal dozens of hot pixels and visible amp glow. The decision table below summarizes typical situations.
| Situation | Recommended approach | Reason |
|---|---|---|
| Single night landscape, 2 to 4 minutes | In-camera noise reduction on | Few frames, matching is automatic |
| Star trails or time-lapse | Noise reduction off, darks taken later | Avoids gaps between frames |
| Deep-sky stacking with cooled camera | Master dark from a library | Stable temperature allows reuse |
| Short handheld exposures | No dark frame needed | Dark current is negligible |
- Record darks during or immediately after the session so the sensor temperature stays similar.
- Cover the eyepiece or viewfinder on DSLR cameras, because stray light can enter through it.
- Keep raw format for both light and dark frames, since JPEG processing breaks linear subtraction.
A non-technical view
Picture an old window with a few permanent smudges. Every photograph taken through it shows the same smudges in the same places. If a photo is taken of pure darkness through that window, only the smudges appear, and they can then be erased from every other photo.
Dark frame subtraction does this for a camera sensor. A long exposure with the lens covered shows only the sensor’s own built-in flaws, and removing that pattern leaves a cleaner picture of the real scene.
A concrete example
A night sky photographer captures the Milky Way core from a desert site in July, using a tracking mount, a full-frame camera at ISO 800 and 180-second exposures. The ambient temperature stays near 24 degrees Celsius, and the first test frame shows scattered red and blue hot pixels plus a faint purple glow in one corner.
Instead of using in-camera noise reduction, which would halve the number of usable frames, the photographer shoots 40 light frames and then 30 dark frames with the lens cap on while the camera is still at the same temperature. Stacking software averages the darks into a master dark and subtracts it from every light frame. The hot pixels and corner glow disappear, and the final stack shows clean dust lanes without the speckled pattern.