AI Photo Colorizer
Operator: Abdulla Al Fahad. How tools are built and checked
A grey photograph holds brightness but no colour, so every colour added to it is a guess. DDColor, the model behind this page, guesses from what it has learned about the world: skies tend to be blue, grass green, skin warm. It is often convincing and sometimes wrong, and no model can know the colour of a particular dress in 1948.
The page runs the DDColor-tiny network in your browser. It keeps the original brightness at the picture's full working resolution and adds only the colour the model predicts, so detail does not get softer. You can then change saturation and warmth, paint the grey back over areas that went wrong, and save up to 20 photos at once.
The first run downloads the model, 135,444,402 bytes (about 129 MiB), from huggingface.co (which sends the request on to its own download host, a cdn.hf.co address) and keeps it in the browser's cache storage; later runs start immediately. The ONNX runtime that executes it is served from this site, not from a CDN.
Key features
- DDColor-tiny, fp16 weights with float32 inputs, pinned to one revision of the published ONNX export and checked by length and by a SHA-256 hash after download and again when read back from the cache
- WebGPU when the browser offers it, with a fall-back to WebAssembly on the CPU, including a retry if the GPU run fails
- Chroma-only colouring: the model's two colour planes are scaled up to the picture and combined with the original lightness in CIE Lab
- Saturation and warmth sliders per photo, and a soft brush that restores the grey where the colour is wrong
- A divider that wipes between the grey original and the result, and batch export to a zip
How the colour is added and what it costs
PNG, JPEG, WEBP and BMP files up to 25 MB are accepted, and the long side is limited to 3,072 px to keep 20 pictures in memory. A larger picture is shrunk on opening and the note under its name says so. Colour photographs are accepted too and are treated as if grey: only their lightness is used.
Lab here is OpenCV's float convention (L from 0 to 100, a and b about ±127), the one DDColor was trained with. The model sees the picture's lightness resized to 512 × 512 and rebuilt as a grey RGB image, and returns two 512 × 512 colour planes.
How it works
Each picture's lightness is computed from sRGB and resized to 512 × 512. The network predicts a and b for each of those cells.
Those planes are enlarged to the picture's size and recombined with the unchanged full-size lightness, then converted back to sRGB.
Saturation multiplies a and b. Warmth shifts b towards yellow and a slightly towards red in proportion to how colourful the pixel already is, so grey stays grey. The brush plane scales the colour of the pixels it covers back to zero.
The model and its inference run in a module worker, so the page stays responsive, and Cancel ends the worker.
Common use cases
- A 1950s family portrait scanned at 2,400 × 1,800 px: colourise, lower saturation to 0.8 so skin is natural, brush the grey back over a wall that turned green.
- Twenty snapshots from one roll: add them all, colourise as a batch, and save the zip.
- A sepia-toned landscape: the model reads only its lightness, so the brown cast is discarded and replaced by predicted colours.
How to use this tool
- Add up to 20 photos.
- Press Colourise; the first time, wait for the model download.
- Adjust saturation and warmth, and brush grey back where a colour is wrong.
- Save the picture, or all of them as a zip.
Example
A 768 × 512 colour snapshot (the Kodak test image kodim23) converted to grey from its Lab lightness, then colourised; a second Kodak test image, kodim15, was run the same way
Default settings, CPU runMeasured against the original colours
Colourfulness (Hasler and Süsstrunk): original 79.47, grey 0.01, colourised 89.84. Mean colour difference from the original (ΔE76) 19.58, against 28.82 for the grey version. A second image: colourfulness 58.70, grey 0.00, colourised 59.22; mean ΔE76 16.47 against 18.93 for grey.Tips for best results
- Warmth and saturation are per photo, so tune the one you are viewing and the others keep their own settings.
- A brush stroke wider than the error is fine; its edge is soft, so the grey blends back in.
- Save as PNG if you plan to edit further; JPEG is smaller for sharing.
Common pitfalls
Colours are a prediction. A uniform, a car, a painted door can come out any plausible colour. Do not present the result as the historical truth.
Very saturated predictions can fall outside what a screen can show; when they are clipped to fit, the lightness of a few pixels changes slightly (up to 10 lightness units at the worst pixels of the example image).
The model sees a 512 × 512 version, so small coloured details such as a lipstick or a flag may be washed out.
Common errors and how to fix them
- The download stops or the model fails to load
- The file must arrive complete and match its SHA-256 hash (both are checked) from huggingface.co. Check your connection and that the site is reachable, then press Colourise again.
- WebGPU is used but the run fails
- The page rebuilds the model on the CPU and retries once. If your browser blocks WebAssembly threads it still works, only more slowly.
- The worker stops while colourising
- A very large batch can exhaust memory. Cancel, remove some photos, and run in smaller groups.
Best practices
- Start from the cleanest scan you have: dust and scratches are read as detail and can pick up odd colours.
- Use the brush on whole objects the model got wrong, such as a wall or a coat, rather than on edges, and keep the original grey next to the result when you share it.
About the model and its licence
DDColor (Kang et al., ICCV 2023) uses two decoders, one for pixel detail and one for colour queries, on a ConvNeXt encoder. The weights used here are the authors' ddcolor_paper_tiny checkpoint, published under Apache-2.0, converted to ONNX by a third party who also publishes the conversion under Apache-2.0 with its provenance and a pinned revision, which is the one this page downloads.
The authors' separate artistic checkpoint is not used. Model files are not stored on this site; the browser fetches them from huggingface.co on the first run and caches them.
What the example numbers mean
Colourfulness measures how far colours spread from grey; ΔE76 measures the distance of each pixel from the original. Colourfulness rose from the grey image's 0.01 to 89.84, which overshoots the original's 79.47; the second image landed close to its original (59.22 against 58.70). ΔE76 fell from 28.82 to 19.58 and from 18.93 to 16.47, so the colours moved towards the originals on average. Neither number tells you whether the colours are right for a photo with no known original.
Frequently asked questions
Does my photo leave my device?
No. Only the model file is downloaded, from huggingface.co (and the cdn.hf.co host it redirects to) on the first use. The picture is processed in a worker in this tab.
How big is the download and is it repeated?
135,444,402 bytes once; after that it is read from the browser's cache storage. Clearing site data removes it.
Why not colourise at the model's own resolution?
The model works on 512 × 512, which is why only the colour planes are enlarged and the brightness is kept from the original; the picture keeps its own detail.
Can I colourise a photo that is already in colour?
Yes, but only its lightness is used, so the original colours are replaced by predictions.