Image Colorization API

by Satoshi Iizuka 170

Colorize black and white images or videos using the image colorization API. Add color to old family photos and historic images, or bring an old film back to life with colorization.

url upload file upload


API Docs
QUICK START API REQUEST
curl \
    -F 'image=YOUR_IMAGE_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/colorizer 

Colorize

old family photos

Bring old family photos back to life with a touch of color

Color Restoration

for historic images

Colorize black and white historic images to bring events back to life

Film Colorization

frame by frame for video files

Add color to every frame of a video file to colorize old black and white films

Image Colorization

Use this deep learning model that has been trained to add color to grayscale images with amazing quality.


Photo Restoration

Add a splash of life back to old family photos or historic images in a fraction of a second with this image colorization API.


Video Colorization

Process entire video files and add color to every frame of a black and white film.


Image Colorization API Information

How does it work?

This image colorization API is a deep learning model that has been trained on pairs of color images with their grayscale counterpart. After hours of training, the models learns how to add color back to black and white images.

Is there a size limit on file uploads?

Yes, the max file upload size is 1200px for any dimension. That being said, If you upload an image with a dimension larger than 1200px, we shrink the image so no dimension is large than that.

Image Colorization API Documentation

Image Colorization cURL Examples

# Example posting a image URL:

curl \
    -F 'image=YOUR_IMAGE_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/colorizer 


# Example posting a local image file:

curl \
    -F 'image=@/path/to/your/file.jpg' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/colorizer 



# Video Mode: Supports files, URLs, and YouTube URLs. See full details and other options at https://deepai.org/api-docs/#video-recognition-api

# Example posting a video URL:

curl \
    -F 'video=YOUR_VIDEO_URL' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/colorizer 


# Example posting a local video file:

curl \
    -F 'video=@/path/to/your/file.mp4' \
    -H 'api-key:YOUR_API_KEY' \
    https://api.deepai.org/api/colorizer 

Image Colorization Javascript Examples

// Get the 'deepai' package here (Compatible with browser & nodejs):
//     https://www.npmjs.com/package/deepai
// All examples use JS async-await syntax, be sure to call the API inside an async function.
//     Learn more about async-await here: https://javascript.info/async-await

// Example posting a image URL:

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("colorizer", {
            image: "YOUR_IMAGE_URL",
    });
    console.log(resp);
})()


// Example posting file picker input image (Browser only):

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("colorizer", {
            image: document.getElementById('yourFileInputId'),
    });
    console.log(resp);
})()


// Example posting a local image file (Node.js only):
const fs = require('fs');

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("colorizer", {
            image: fs.createReadStream("/path/to/your/file.jpg"),
    });
    console.log(resp);
})()



// Video Mode: Supports files, URLs, and YouTube URLs. See full details and other options at https://deepai.org/api-docs/#video-recognition-api


// Get the 'deepai' package here (Compatible with browser & nodejs):
//     https://www.npmjs.com/package/deepai
// All examples use JS async-await syntax, be sure to call the API inside an async function.
//     Learn more about async-await here: https://javascript.info/async-await

// Example posting a video URL:

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("colorizer", {
            video: "YOUR_VIDEO_URL",
    });
    console.log(resp);
})()


// Example posting file picker input video (Browser only):

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("colorizer", {
            video: document.getElementById('yourFileInputId'),
    });
    console.log(resp);
})()


// Example posting a local video file (Node.js only):
const fs = require('fs');

const deepai = require('deepai'); // OR include deepai.min.js as a script tag in your HTML

deepai.setApiKey('YOUR_API_KEY');

(async function() {
    var resp = await deepai.callStandardApi("colorizer", {
            video: fs.createReadStream("/path/to/your/file.mp4"),
    });
    console.log(resp);
})()

Image Colorization Python Examples

# Ensure your pyOpenSSL pip package is up to date
# Example posting a image URL:

import requests
r = requests.post(
    "https://api.deepai.org/api/colorizer",
    data={
        'image': 'YOUR_IMAGE_URL',
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())


# Example posting a local image file:

import requests
r = requests.post(
    "https://api.deepai.org/api/colorizer",
    files={
        'image': open('/path/to/your/file.jpg', 'rb'),
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())



# Video Mode: Supports files, URLs, and YouTube URLs. See full details and other options at https://deepai.org/api-docs/#video-recognition-api


# Ensure your pyOpenSSL pip package is up to date
# Example posting a video URL:

import requests
r = requests.post(
    "https://api.deepai.org/api/colorizer",
    data={
        'video': 'YOUR_VIDEO_URL',
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())


# Example posting a local video file:

import requests
r = requests.post(
    "https://api.deepai.org/api/colorizer",
    files={
        'video': open('/path/to/your/file.mp4', 'rb'),
    },
    headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())

Image Colorization Ruby Examples

# Example posting a image URL:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/colorizer', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'image' => 'YOUR_IMAGE_URL',
    }
)
puts r


# Example posting a local image file:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/colorizer', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'image' => File.new('/path/to/your/file.jpg'),
    }
)
puts r



# Video Mode: Supports files, URLs, and YouTube URLs. See full details and other options at https://deepai.org/api-docs/#video-recognition-api

# Example posting a video URL:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/colorizer', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'video' => 'YOUR_VIDEO_URL',
    }
)
puts r


# Example posting a local video file:

require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/colorizer', timeout: 600,
    headers: {'api-key' => 'YOUR_API_KEY'},
    payload: {
        'video' => File.new('/path/to/your/file.mp4'),
    }
)
puts r

Image Colorization Csharp Examples

// Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a image URL:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("colorizer", new {
        image = "YOUR_IMAGE_URL",
});
Console.Write(api.objectAsJsonString(resp));


// Example posting a local image file:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("colorizer", new {
        image = File.OpenRead("C:\\path\\to\\your\\file.jpg"),
});
Console.Write(api.objectAsJsonString(resp));



// Video Mode: Supports files, URLs, and YouTube URLs. See full details and other options at https://deepai.org/api-docs/#video-recognition-api


// Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a video URL:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("colorizer", new {
        video = "YOUR_VIDEO_URL",
});
Console.Write(api.objectAsJsonString(resp));


// Example posting a local video file:

using DeepAI; // Add this line to the top of your file

DeepAI_API api = new DeepAI_API(apiKey: "YOUR_API_KEY");

StandardApiResponse resp = api.callStandardApi("colorizer", new {
        video = File.OpenRead("C:\\path\\to\\your\\file.mp4"),
});
Console.Write(api.objectAsJsonString(resp));