Color match — paint one photo with another's mood

Picks up the colour mood of a reference photo and paints it onto your target. Great for harmonising photos taken under different lighting, matching a whole shoot to one hero image, aligning screenshot palettes across light- and dark-mode themes, or warming up washed-out legacy material to fit a modern look. Lock a reference, drop in any number of targets — the engine only crunches the reference once, so batching a folder against one master is fast.

TARGET
TARGET — Color match — paint one photo with another's mood
REFERENCE
REFERENCE — Color match — paint one photo with another's mood
Target → reference look
Target → reference look — Color match — paint one photo with another's mood
JavaScript
// Color transfer — match a target's tones to a reference (Reinhard, log-LMS)
// demo_color_transfer.js
//!INPUT: TARGET, REFERENCE
//!OUTPUT: OUTPUT

// Reinhard (2001) color transfer in log-LMS space — perceptually
// well-behaved tone matching. The TARGET image's per-channel mean
// and standard deviation are shifted to match the REFERENCE's. Works
// great for harmonising photos shot under different lighting,
// matching screenshot palettes across OS themes, or reviving washed-
// out legacy material to fit a modern hero shot.
//
// Pipeline:
//   1. Engine.colorStats(reference) — compute reference stats once.
//   2. target.colorTransfer(stats)   — shift target to match.
//
// The colorStats() / colorTransfer() split lets you batch one
// reference against many targets without recomputing reference
// stats on every call.

const target = Engine.loadImage(TARGET);
const ref    = Engine.loadImage(REFERENCE);

const stats = Engine.colorStats(ref);
console.log(`reference log-LMS mean: [${stats.mean.map(v => v.toFixed(3)).join(', ')}]`);
console.log(`reference log-LMS std:  [${stats.std.map(v => v.toFixed(3)).join(', ')}]`);

target.colorTransfer(stats).save(OUTPUT);

ref.free();
target.free();

// © 2026 Michael Lechner · mlc OpticScript · https://mlcgo.eu · Elastic License 2.0