Camera Color
A camera sensor is colorblind. It counts photons - brightness only - and yet a photo comes out in full color. Between those two facts is a clever pipeline: a grid of tiny color filters, an algorithm that guesses the missing colors, a white-balance correction, and a matrix that turns the sensor's quirky response into real color. This is the interactive tour from photons to pixels.
The sensor sees no color
A digital sensor is a grid of light buckets. Each photosite counts photons and reports a single number - how much light, not what color. On its own a sensor would only ever produce a grayscale image. To capture color, the camera puts a color filter over each pixel so that pixel responds to only red, only green, or only blue light. Color, in a camera, is reconstructed from a mosaic of single-color measurements - not measured directly.
That single design choice - filter, then reconstruct - ripples through everything: why files need demosaicing, why white balance is a set of gains, why a color matrix exists, and why raw preserves so much more than JPEG. The rest of the article follows the data from photosite to finished pixel.
The Bayer array and demosaicing
The dominant filter pattern is the Bayer array: a repeating 2×2 tile of one red, two green, one blue (RGGB). There are twice as many green sites because our eyes are most sensitive to green and it carries most of the luminance detail. The sensor's raw output is therefore a mosaic - each pixel holds just one channel. Demosaicing reconstructs the full image by interpolating the two missing channels at every pixel from its neighbors.
Filter the scene, then reconstruct it
The same scene in three states. Scene is the full-color truth. Bayer mosaic is what the sensor actually records - every pixel keeps only its filter's color, so it looks like a grid of red, green, and blue dots. Demosaiced interpolates the missing channels back to full color. Zoom is pixelated so you can see the mosaic.
White balance from raw
The raw sensor data is not white-balanced - under warm light the red channel reads high and blue low, and vice versa. White balance in a camera is simply a set of per-channel gains (usually scaling red and blue relative to green) that make a neutral object read equal across channels. Because raw stores the data before these gains are baked in, you can set white balance freely after the fact with no quality loss.
Neutralize the cast with R and B gain
The raw image carries a color cast from the light. Adjust the red and blue gains (green is the reference) until the gray card reads neutral - equal R, G, B. This is exactly what a camera's white balance does, and on a raw file you can redo it anytime.
The camera color matrix
Even white-balanced, the sensor's raw RGB is not "real" color - the filter sensitivities do not match human cones, so colors come out dull and slightly off, with channels that overlap differently than our eyes. A color matrix (a 3×3 transform, part of the camera's color profile) maps the camera's native response into a standard space like sRGB or a profile connection space. This is the step that turns flat sensor data into accurate, saturated color - and why two cameras need different profiles.
From muddy sensor response to true color
On the left is the white-balanced but uncorrected sensor color - desaturated and slightly green-biased, as raw often looks. Drag the matrix strength to apply the camera's color correction; the right panel snaps to accurate, properly saturated color. This is the camera profile doing its job.
After color matrix
Raw vs JPEG
A JPEG is a finished photo: the camera has already demosaiced, white-balanced, applied the color matrix and tone curve, sharpened, and compressed to 8 bits - all decisions baked in. A raw file stores the high-bit sensor data with those steps recorded as editable instructions. The biggest practical payoff is highlight recovery: a raw file often holds detail in bright areas that look pure white in the JPEG, because the JPEG has already clipped them to 255.
Pull back the exposure: what survives?
Both frames are overexposed at the top. Drag the exposure recovery down. The JPEG already clipped its brightest pixels to white, so they stay flat gray - the detail is gone. The raw kept the headroom, so the same recovery reveals the gradient that was there all along.
JPEG (clipped)
Raw (headroom)
The full capture pipeline
Putting it together, light becomes a finished color image through a fixed chain - whether the camera does it instantly for a JPEG or you do it later from raw.
Practical guide
| If you want… | Do this |
|---|---|
| Maximum color/edit latitude | Shoot raw; set white balance and tone in post, non-destructively. |
| To recover bright skies / windows | Expose to protect highlights and recover from raw, not JPEG. |
| Accurate color from a camera | Use a proper camera profile (color matrix), not a generic one. |
| Consistent color across cameras | Profile each camera (or shoot a color target) and convert to a common space. |
| Smaller files, instant sharing | JPEG/HEIF is fine - just accept the baked-in decisions. |
| Clean edges without color fringes | Rely on good demosaicing; avoid extreme sharpening that exaggerates artifacts. |
Pitfalls and gotchas
Test your understanding
Six questions on the Bayer array, demosaicing, white balance, and raw. Instant feedback, no scores recorded - a wrong answer comes with a short explanation.
Quick check
Continue your journey
Capture is the front of the pipeline whose later stages this library covers. The numbers reflect each article's position in the editorial roadmap.
Color in Film and Video: Log, LUTs, and Grading
The moving-image cousin: capture flat, then grade and deliver.
Digital · 35Bit Depth, Channels, and Alpha
Why raw's high bit depth gives editing and recovery headroom.
Physics · 28Color Temperature and White Balance
The light the camera's white-balance gains are correcting for.
Digital · 17Gamma, Linear Light, and Transfer Functions
Why raw is linear and needs a tone curve before it looks right.
Digital · 16ICC Profiles and How Color Management Works
The profile system the camera color matrix feeds into.
Vision · 05Human Color Vision: Cones, Opponent Signals, and the Brain
The cones the Bayer array and color matrix are trying to emulate.