Colorize Photo

FREEMIUM
Popularity

9.2 / 10

Latency

857ms

Service Level

99%

Health Check

100%

Back to All Tutorials (4)

Simple snippet to colorize one image with defaults (Python)

import requests

X_RapidAPI_Key = '4116843d07msh704be0dfa337826p108b3fjsn72323’
X_RapidAPI_Host = ‘colorize-photo1.p.rapidapi.com

headers = {
“X-RapidAPI-Key”: X_RapidAPI_Key,
“X-RapidAPI-Host”: X_RapidAPI_Host
}

url = “https://” + X_RapidAPI_Host + /colorize_image_with_auto_prompt"
files = {‘image’: (‘black_and_white.jpg’, open(’ ./black_and_white.jpg’, ‘rb’), ‘image/jpeg’ )}
headers = {“X-BLOBR-KEY”: “”}
response = requests.post(url, files=files, headers=headers)
f = open( ‘colorized_image.jpg’, ‘wb’ )
f.write(response.content)
f.close()