← All models

image-to-image (colorization) Β· vision Β· WASM Β· ~130 MB

DDColor β€” bring black-and-white photos to life

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.

At a glance

Modeledgetools/ddcolor β€” DDColor-tiny (ICCV 2023), ONNX export for the web
Taskimage-to-image (image colorization) β€” run via raw ONNX Runtime Web (see note below)
Runtimeonnxruntime-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
Quantizationfp16 weights, fp32 I/O (keep_io_types) β€” runs on the plain WASM execution provider, no WebGPU needed
BackendWebAssembly (single-threaded on GitHub Pages) β€” a 512Γ—512 pass is a few seconds
Download~130 MB, cached after first load (auto-inits on return)
LicenseApache-2.0 (ONNX export) Β· DDColor (Apache-2.0)
Web APIsWebAssembly, Web Workers, OffscreenCanvas, ImageBitmap β€” all Baseline widely available

Run it

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.

β—€ grayscale inputcolourised β–Ά
Drop / choose your own photo (a genuine B&W photo works best)

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).

See inside

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.

Colourise a photo to see its chroma field.

Why it matters

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.

Use cases

Basics

One grayscale photo in, colour out β€” watch the model invent a full palette and wipe between before/after.

Practical

Restore an old photo: colourise a genuine black-and-white scan and download the result, all on-device.

Wild

How close did the AI get? Colourise a photo whose real colours we know, then reveal the ground truth to score it.

Multi-model

Colourise β†’ detect: recolour a grayscale scene, then run object detection on the result.

How the API works

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.

References