image-to-image (colorization) Β· vision Β· WASM Β· ~130 MB
Give this model a grayscale photo and it invents plausible colour: blue skies, green foliage, warm skin tones, painted walls. DDColor predicts chroma only β the brightness and every fine detail come straight from your original image, so nothing is blurred or hallucinated into the structure; only the colour is added. It runs entirely on your device via ONNX Runtime Web; the photo never leaves the tab.
| Model | edgetools/ddcolor β DDColor-tiny (ICCV 2023), ONNX export for the web |
|---|---|
| Task | image-to-image (image colorization) β run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no DDColor class / no image-colorization task) |
| Input | [1, 3, 512, 512] float32 β a grayscale RGB rebuilt from the L (luminance) channel, values 0β1, no ImageNet normalisation |
| Output | [1, 2, 512, 512] float32 β the predicted ab chroma (CIE-Lab); upsampled and recombined with your full-resolution luminance |
| Quantization | fp16 weights, fp32 I/O (keep_io_types) β runs on the plain WASM execution provider, no WebGPU needed |
| Backend | WebAssembly (single-threaded on GitHub Pages) β a 512Γ512 pass is a few seconds |
| Download | ~130 MB, cached after first load (auto-inits on return) |
| License | Apache-2.0 (ONNX export) Β· DDColor (Apache-2.0) |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, ImageBitmap β all Baseline widely available |
Pick a photo (or drop your own). We strip its colour to grayscale β exactly what the model sees β then DDColor invents new colour. Drag the divider to compare before/after.
DDColor predicts chroma only β brightness and detail are 100% your original photo, so the structure is never altered. βChroma stdβ is how much colour the model actually invented (0 = it left it gray).
Everything runs on your device β the photo and every colourised pixel never leave the tab. Gallery images are rights-cleared samples (see each caption for the source).
DDColor never touches your image's brightness β its only output is a chroma field: two numbers per pixel (a and b, the colour axes of CIE-Lab). Below is that raw chroma the model invented, shown at a fixed mid-brightness so you see the colour alone, decoupled from the photo. Recombine it with your original luminance and you get the result above.
Warm regions (reds, oranges) are where the model expects skin, brick, wood or sunset; cool regions (blues, greens) are sky, water, foliage. Flat gray means the model is unsure and left it near-neutral. Because this is only 512Γ512 chroma, it is intentionally soft β the sharp detail all comes from your luminance.
Colourisation used to mean a cloud service (upload your family photos to who-knows-where) or a desktop tool. Running it in the browser makes it private and instant β the archive never leaves the device. And because DDColor only predicts colour, it slots into any pipeline without degrading the original:
DDColor invents plausible colour, not the true historical colour β treat it as an artistic reconstruction, not a factual record.
One grayscale photo in, colour out β watch the model invent a full palette and wipe between before/after.
Restore an old photo: colourise a genuine black-and-white scan and download the result, all on-device.
How close did the AI get? Colourise a photo whose real colours we know, then reveal the ground truth to score it.
Colourise β detect: recolour a grayscale scene, then run object detection on the result.
transformers.js has no DDColor class and no image-colorization task, so we run the ONNX graph directly with ONNX Runtime Web. The model wants luminance and returns chroma:
import * as ort from "onnxruntime-web";
const session = await ort.InferenceSession.create(ddcolorBytes, { executionProviders: ["wasm"] });
// image β grayscale RGB rebuilt from the L channel, resized to 512Γ512, values [0,1] (no normalise)
const input = new ort.Tensor("float32", grayFrom(image), [1, 3, 512, 512]);
const { [session.outputNames[0]]: ab } = await session.run({ [session.inputNames[0]]: input });
// ab is [1,2,512,512] chroma β upsample, recombine with the ORIGINAL full-res luminance, LabβRGB
const colour = labToRgb(originalL, ab.data);
Inference and the whole LabβRGB composite run in a Web Worker so the UI never blocks, and the 130 MB model is fetched through Cache Storage, so a returning visit auto-initialises with no re-download.