Colorize Photo

FREEMIUM
Durch Palette AI | Aktualisiert 2 months ago | Artificial Intelligence/Machine Learning
Popularität

9.3 / 10

Latenz

949ms

Service Level

99%

Health Check

100%

Zurück zu allen Tutorials (4)

Simple snippet to colorize one image with defaults and exposing variables (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’ )
}
data = {
“resolution”: “watermarked-sd”, # watermarked-sd, sd, full-hd, or 4k
"prompt": “”, # replace with custom prompt
"standard_filter_id": “1”, # 1-20 default filters
"artistic_filter_id": “O”, # 1-100 more creative filters
"raw_captions": “false”, # true or false, remove post and prefix from promot
"pre_fix": “”, # create your own pre_fix, e.g. A photo of
"post_fix": “”, # create your own pre_fix, e.g. HDR and colorful.
“auto_color”: “true”, # true or false, color balancing
"white_balance": “false”, # white balancing
"temperature": “-0.1”, # 0.0 - 1.0, cold or warm filter
"saturation": “1.1” # 0.0 - 2.0, adjust saturation
}

response = requests.post(url, files=files, data=data, headers=headers)
f = open( ‘colorized_image.jpg’, ‘wb’ )
f.write(response.content)
f.close()