From Photon to Pixel
The Long Way from Light to JPEG
A plain-language, code-first tour of the RAW-to-JPEG pipeline — from photon to pixel.
- 0SetupWhy this book, the toolkit, and the contract every line of code in it obeys.
- 1The Simulated Camera SystemScenes as spectra, fictional lenses, a noisy sensor — ground truth for the whole book.
- 2From Photons to a Bayer ArrayExposure, noise, black level, and why the sensor sees a mosaic instead of a picture.
- 3White Balance Comes FirstUndoing the illuminant on the raw mosaic — and proving the pipeline's order matters.
- 4DemosaicingFrom one value per pixel to three: bilinear, edge-aware, and AHD, measured against truth.
- 5Getting the Color RightCamera RGB is not a color space; the matrix that maps it toward one, derived from spectral ground truth.
- 6Undoing the LensVignetting, chromatic aberration, and distortion, inverted from known coefficients.
- 7ToneGamma, curves, highlight reconstruction, and local tone mapping.
- 8Detail and NoiseSharpening and noise reduction, from unsharp mask to Non-Local Means.
- 9Output EncodingResampling, chroma subsampling, and a from-scratch JPEG encoder.
- 10Closing the LoopA real raw file through the reader's own pipeline — and why no two renderings agree.
- AThe pxp PackageThe simulated camera and pipeline as a standalone package — API reference.
- BGlossaryOECF, CFA, PSF, gamut, and the rest of the pipeline's vocabulary.
- CFurther ReadingSources by pipeline stage — split into 'safe to reimplement' and 'read for understanding only'.