AI Colorization: DeOldify & Stable Diffusion

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1566 services
AI Colorization: DeOldify & Stable Diffusion
Simple
~2-3 days
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1317
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1226
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    925
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1156
  • image_logo-advance_0.webp
    B2B Advance company logo design
    620
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    894

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.