AI Colorization: DeOldify & Stable Diffusion

Archives of black-and-white photos need revival, but manually colorizing each image takes hours. We automate this process using DeOldify and Stable Diffusion neural networks, which pick natural colors based on the photo's context. Our team delivers a turnkey project—from model adaptation to integration into your pipeline—ensuring reliable operation and ongoing support.

AI Development Areas

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1344
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1306
  • B2B Advance company logo design
    B2B Advance company logo design
    753
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1049
  • AIDER company logo development
    AIDER company logo development
    992
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1097

Black-and-White Image Colorization with AI

Have an archive of black-and-white photos that need colorization, but manual coloring takes hours per image? We solve this with neural networks: DeOldify and Stable Diffusion img2img. They automatically assign colors based on context—sky blue, grass green, skin tones. No manual markup, minutes per batch. We processed over 50,000 frames for three museums and two film archives, averaging 0.4 seconds per image on an NVIDIA A100.

How AI Colorization Works

The neural network analyzes brightness, textures, and objects in the photo, then predicts the most likely color for each pixel. DeOldify uses a generative adversarial network trained on millions of black-and-white and color image pairs. Stable Diffusion in img2img mode adds control via text prompts—you can specify era, region, or even sky hue. We adapt both models to your source images—for historical portraits we increase the weight of skin in the loss function.

DeOldify — The Classic Coloring Approach

from deoldify import device
from deoldify.device_id import DeviceId
from deoldify.visualize import get_image_colorizer
import PIL.Image as Image
import io

device.set(device=DeviceId.GPU0)
colorizer = get_image_colorizer(artistic=True)  # artistic=True — more saturated colors

def colorize_image(image_bytes: bytes, render_factor: int = 35) -> bytes:
    """
    render_factor: 7-45, higher = more saturated, slower
    """
    input_image = Image.open(io.BytesIO(image_bytes)).convert("L").convert("RGB")
    # Save temporarily
    import tempfile, os
    with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as f:
        input_image.save(f.name)
        temp_path = f.name
    result = colorizer.get_transformed_image(temp_path, render_factor=render_factor)
    os.unlink(temp_path)
    buf = io.BytesIO()
    result.save(buf, format="JPEG", quality=95)
    return buf.getvalue()

Stable Diffusion img2img Approach

from diffusers import StableDiffusionImg2ImgPipeline
import torch

pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    torch_dtype=torch.float16
).to("cuda")

def colorize_with_sd(bw_image: bytes, prompt_hint: str = "") -> bytes:
    init_image = Image.open(io.BytesIO(bw_image)).convert("RGB")
    prompt = f"colorized photograph, natural colors, realistic{', ' + prompt_hint if prompt_hint else ''}"
    result = pipe(
        prompt=prompt,
        image=init_image,
        strength=0.5,  # Low strength preserves structure
        guidance_scale=8.0,
        num_inference_steps=30
    ).images[0]
    buf = io.BytesIO()
    result.save(buf, format="JPEG", quality=95)
    return buf.getvalue()

Comparison of Approaches

Parameter DeOldify (artistic) Stable Diffusion img2img
Quality on historical photos Excellent (trained on real B&W) Good, requires prompt
Prompt control No Yes (era, region, colors)
Video support Yes, temporal consistency No (needs adaptation)
Processing time (1 frame, 512px) ~0.5 sec (GPU) ~1.5 sec (GPU)
Ease of integration High (Python API) Medium (needs Hugging Face)

DeOldify Parameter Table

Render factor Quality Time per frame (A100)
7 (fast) Moderate 0.15 sec
35 (recommended) Good 0.4 sec
45 (maximum) Excellent 0.7 sec

Why DeOldify is Better for Archival Photos

For archival photos, DeOldify produces the most natural colors—it is trained specifically on historical images and doesn't require manual prompts. Stable Diffusion img2img wins when you need to tailor to a specific era or artistic style. In our projects, we combine both: DeOldify for bulk colorization, SD for complex scenes.

Problems We Solve

  • Loss of temporal consistency in video. DeOldify with temporal consistency enabled prevents colors from jumping between frames. For long videos we use GPU buffering and a sliding window.
  • Uneven brightness and noise. Preprocessing (denoising with OpenCV, CLAHE for contrast) improves result quality by 20-30%.
  • Unrealistic skin tones. We use models fine-tuned on early 20th-century portraits—datasets from the Museum of Modern Art are available.

How We Do It: A Case Study

For a museum with an archive of 5,000 black-and-white photos, we deployed a DeOldify-based pipeline with batch processing on an NVIDIA A100. Average time per photo was 0.3 seconds. For 10% of difficult frames (night, high contrast) we used SD img2img with a prompt describing the era. Result: all photos colorized in 2 days, colors natural, the museum used them for a digital exhibition. Time savings compared to manual colorization: 500x.

Process of Work

  1. Analysis and Preparation — assess source quality, denoise, crop.
  2. Pipeline Design — choose model (DeOldify / SD / combination), tune parameters.
  3. Implementation — integrate API, batch processing, temporal consistency for video.
  4. Testing — validate on a sample, A/B comparison, fine-tune render_factor / strength.
  5. Deployment — containerize (Docker + FastAPI), schedule automatic runs.

What's Included in the Work

  • Model and API documentation
  • Access to the deployed service with dashboard
  • Training for your engineers on pipeline usage
  • Quality guarantee on first 100 frames (free revisions)
  • 3 months of support after launch

Timeline and Cost

Integration timeline ranges from 1 to 3 days depending on volume. Cost is calculated individually: we assess the project, select the optimal GPU configuration and model. To get a consultation for your project, contact us—we'll design the optimal pipeline and estimate the cost. You can also order a test colorization of 10 frames—results within a day.

Our team has 10+ years in Computer Vision and 40+ projects in colorization and image restoration. We work with both one-time orders and large archives. Leave a request—we'll send examples and help bring your archival materials to life.