1 The Chemistry of Photographic Fading
Physical photographs are not permanent. The organic dye molecules and silver halide crystals suspended in a gelatin emulsion are highly susceptible to environmental degradation. Over decades, exposure to ultraviolet light, humidity, airborne pollutants, and outgassing from acid-containing album materials causes the chemical bonds in these dyes to irreversibly break.
Critically, cyan and magenta dye layers degrade at a significantly faster rate than yellow dye layers. This differential decay rate produces the characteristic warm yellow-orange color shift universally associated with aged photographs. Simultaneously, the metallic silver density in the emulsion thins out, converting what were once deep blacks to muddy mid-greys — collapsing the image's dynamic range from perhaps 7 stops down to 3–4 stops of visible luminance separation.
Our restoration engine targets both symptoms simultaneously: the histogram stretch algorithm restores the collapsed dynamic range, while the per-channel white balance correction precisely neutralizes the differential dye decay by analyzing and correcting each color channel independently.
2 Archival Digitization: Scanning Best Practices
The quality of the digital restoration is fundamentally bounded by the quality of the initial scan. Before uploading to any restoration tool, obtaining a high-fidelity scan is the most important step in the entire workflow.
| Format / Size | Minimum DPI | Recommended DPI | Notes |
|---|---|---|---|
| Standard 4×6 inch print | 600 DPI | 1200 DPI | Safe for A4 reprints |
| Wallet-size print | 1200 DPI | 2400 DPI | High magnification needed |
| 8×10 inch print | 400 DPI | 600 DPI | Already large — 600 DPI exceeds screen PPI |
| 35mm film negative/slide | 3200 DPI | 4800 DPI | Small frame, maximum detail needed |
| Medium-format film (120) | 1600 DPI | 2400 DPI | Larger frame, less magnification needed |
| Polaroid instant print | 800 DPI | 1200 DPI | Emulsion is fragile — scan once correctly |
Critical setting: Disable all automatic enhancement, Auto-Color, Digital ICE, Grain Reduction, and Digital ROC features in your scanner software. These proprietary algorithms apply irreversible destructive compression to your scan before it is saved, permanently discarding the tonal information this tool needs to restore the image correctly. Save the master scan as a lossless TIFF or maximum-quality JPEG before uploading.
3 Histogram Stretch: The Core Contrast Algorithm
When viewed as a digital histogram, a faded photograph displays a characteristic narrow spike clustered in the midtone region, with completely empty zones at both the shadow and highlight extremes. For example, a severely faded scan might have all pixel values compressed between level 60 and level 190, with nothing below 60 (pure black) or above 190 (pure white).
The Histogram Stretch (also called Linear Contrast Stretch or Normalization) algorithm solves this precisely:
- Analysis pass: The engine iterates over all pixels to find the actual minimum (P_min) and maximum (P_max) luminance values present in the scan, using the 2nd and 98th percentiles to ignore isolated dust specks that would skew the endpoints.
- Remap formula: Each pixel's value is recalculated as:
P_new = (P_old − P_min) ÷ (P_max − P_min) × 255 - Blend: The slider intensity blends between the original and the stretched value — a value of 0.7 applies 70% stretch, giving you precise control over how aggressively the contrast is recovered.
This is mathematically equivalent to dragging the black point and white point sliders in Lightroom's Develop module — but fully automated, applied to the per-channel luminance values independently.
4 Per-Channel White Balance Correction
The De-Yellowing slider applies a precision per-channel white balance correction — the same mathematical operation used in professional RAW processing workflows. The algorithm works in four steps:
- Channel analysis: The engine calculates the 98th percentile value of the Red, Green, and Blue channels separately across all pixels. In a yellow-cast image, Red and Green will have high percentile values; Blue will be low.
- Gain calculation: A correction gain (g) is calculated for each channel as
g = 255 ÷ P98_channel. This scales each channel so that the near-white tones in that channel map to 255. - Application: Each pixel's channel values are multiplied by their respective gains and clamped to 0–255. This differentially amplifies the deficient Blue channel while attenuating the over-inflated Red channel.
- Blend: The slider blends between original and corrected values, preventing over-correction that would push the image toward a cold blue cast.
Unlike simple "reduce red" approaches, this method preserves the underlying color relationships within the image — skin tones remain natural, blue skies become properly saturated, and fabric colors are recovered rather than neutralized to grey.
5 Gamma Correction & Midtone Lift Explained
Gamma Correction applies a power-curve transformation to the pixel values: P_new = (P_old / 255)^(1/γ) × 255. A gamma value above 1.0 brightens the image — particularly the midtones — without clipping highlights. A value below 1.0 darkens and adds tonal depth.
For scanned photos that appear flat and washed-out even after histogram stretching, increasing gamma to 1.2–1.4 lifts the shadow-to-midtone gradient, revealing detail in clothing folds, facial shadows, and background architecture that was previously lost in compressed grey values.
Midtone Lift adds a flat offset to all pixel values before clamping. Positive values brighten all tones uniformly — useful for very dark underexposed scans. Negative values deepen the image. Unlike gamma, this is a linear offset rather than a curve, making it better suited for absolute shadow recovery on severely underexposed scans.
6 Luminance-Only USM Sharpening — Zero Color Halos
The Detail Recovery slider applies a true Unsharp Mask (USM) exclusively to the luminance channel. The process:
- Calculate per-pixel luminance using Rec. 601 weights:
L = R×0.299 + G×0.587 + B×0.114 - Compute a 3×3 box-blur estimate of each pixel using its 8 neighbours
- The high-pass signal =
L_original − L_blurred - Only apply amplification where
|high-pass| > noise_gate(set by the Grain Noise Gate slider) - The sharpened luminance delta is added back to all three RGB channels equally, preserving the original color ratios
Applying USM only to the luminance channel prevents the RGB channel misalignment artifacts that appear as colored halos (green-magenta fringing) when RGB channels are sharpened independently — the professional technique used in all studio-grade retouching workflows.
7 Noise Gate — Protecting Film Grain from USM
Vintage film grain is one of the most recognizable artifacts of analog photography. The Grain Noise Gate slider sets the minimum high-pass delta required before sharpening is applied to a pixel. If the difference between the original pixel and its blurred estimate is below the threshold, the pixel is left completely untouched.
This is critical: film grain is high-frequency variation at roughly the same spatial scale as fine texture detail. Without a noise gate, USM would amplify both the genuine edge data and the grain noise simultaneously, producing a harsh, crunchy "over-sharpened" look. With the noise gate set to 8–15, the fine grain texture passes through untouched while genuine edge transitions (lens boundaries, facial features, clothing seams) are sharpened aggressively.
8 Saturation Recovery After Contrast Restoration
Faded photographs have suppressed colour saturation for the same reason they have collapsed contrast — the dye density is lower throughout. When you stretch the histogram to restore contrast, the luminance channel is expanded but the colour channel relative saturation remains at the faded level.
The Saturation Restore slider applies a targeted colour amplification using the HSL colour model. Each pixel is converted to Hue/Saturation/Lightness, the Saturation value is multiplied by 1 + (slider × 1.5), and the pixel is converted back to RGB. Using HSL ensures that increasing saturation doesn't shift the hue of skin tones or produce illegal out-of-gamut values — the luminance channel is completely preserved during this operation.
9 Client-Side Privacy Architecture
Historical family photographs are among the most sensitive personal data that exists. The overwhelming majority of commercial "AI photo restoration" apps require you to upload your scans to remote cloud servers — where your ancestors' faces, addresses, names visible in photos, and private family moments are exposed to third parties and in many cases used to train facial recognition algorithms.
This tool categorically rejects that architecture. When you select a file, the browser's FileReader API reads it directly into local memory as a DataURL — no network request is made. All five algorithm passes (histogram stretch, per-channel white balance, gamma correction, saturation restore, USM sharpening) execute as JavaScript operating on a Uint8ClampedArray typed buffer inside the browser's sandboxed memory. The restored image is serialized to a download URL using canvas.toDataURL() — entirely locally. Your photos are mathematically impossible to exfiltrate by this tool.
10 JPEG vs PNG vs TIFF: Choosing the Right Archival Format
Choosing the correct export format for your restored photo determines whether your digital archive will remain pristine for the next 50 years or degrade with every copy:
- JPEG (Share): Maximum compatibility. Excellent for emailing, posting on social media, or sharing with relatives. Use 95%+ quality. However, JPEG is lossy — each re-save discards tonal micro-data. Never use JPEG as your master archival format.
- PNG (Archival Master): Lossless compression — every pixel is preserved exactly. File sizes are larger but every re-export from PNG is bit-for-bit identical. Use PNG for your master archive copy. This tool exports PNG at maximum bit-depth available from the Canvas API (8-bit per channel, 32-bit RGBA).
- TIFF (Professional Archive): The gold standard for archival institutions. Supports 16-bit per channel (65,536 tonal levels vs JPEG's 256), multiple layers, embedded color profiles, and metadata. Export as PNG from this tool, then convert to TIFF 16-bit using a dedicated tool for true archival master storage.
- WebP (Digital Distribution): Google's modern format offering superior compression vs JPEG at equivalent quality. Ideal for web publishing. Lossless WebP is supported for PNG-equivalent output.
11 Full Algorithm Pipeline — Processing Order
| Pass | Algorithm | Input | What it Fixes |
|---|---|---|---|
| 1 | Histogram Stretch | Original pixels | Collapsed dynamic range — restores blacks and whites |
| 2 | Midtone Lift + Gamma | Pass 1 output | Shadow crushing, flat midtones, overall brightness |
| 3 | Per-Channel White Balance | Pass 2 output | Yellow/sepia cast from differential dye decay |
| 4 | Saturation Restore (HSL) | Pass 3 output | Dull, de-saturated faded colors |
| 5 | Luminance USM + Noise Gate | Pass 4 output | Scanner softness, lens blur, fine edge detail |
Processing order is critical: contrast restoration is always applied before color correction, which is always applied before sharpening. Sharpening before color correction would amplify the colour cast artifacts at edges. Color correction before contrast stretching would be operating on the collapsed tonal range, reducing the precision of the channel gain calculation.
12 Common Photo Restoration Mistakes to Avoid
- Over-sharpening: The most visible mistake. Excessive USM creates bright white halos along every edge, making the photo look digitally manipulated rather than restored. Keep Detail Recovery below 70% and use the Before/After slider at 100% zoom to check for halos.
- Scanning with Auto-Enhance enabled: Scanner software auto-enhancement irreversibly discards shadow and highlight detail before the JPEG is even saved. You cannot restore data that the scanner already deleted. Always scan in manual mode at maximum bit depth.
- Over-correcting yellow cast: Pulling De-Yellowing to 100% on a mildly faded photo will push the image to a cold, clinical blue tone. Start at 60–75% and judge the skin tones — they should look warm but not orange.
- Sharpening from a low-resolution scan: Sharpening a 300 DPI scan creates visible pixel staircase artifacts on diagonal edges. Re-scan at 600+ DPI before applying any sharpening operations.
- Saving restored JPEG multiple times: Every JPEG save cycle applies additional lossy compression to the already-compressed image. Save your master restoration as PNG, then export a JPEG copy for sharing. Never re-compress the master.