Links

Your first request

How to make your first request

1. Click on the plan you subscribed to

2. Click on Authentication in the left menu

Key details you need to make a request
  • Base product URL: Every subscription plan has a unique starting url
  • Blobr API keys: You need to add the key in the 'X-BLOBR-KEY' field in the header

3. Click on Endpoints in the left menu

For all your endpoints, add the 'Base URL' above, for example:
If you click on one of the endpoints it also provides you with the complete URL including the base url.

4. Colorize one image

A simple python example using the default values (Image subscription)

import requests
# Change the URL to match your base URL
url = "https://apis.palette.fm/105esxukgwqbp7g4/colorize_image_with_auto_prompt"
files = {'image': ('black_and_white.jpg', open(' ./black_and_white.jpg', 'rb'), 'image/jpeg' )}
headers = {"X-BLOBR-KEY": "YOUR API KEY"} #Add your API KEY
response = requests .post(url, files=files, headers=headers)
f = open( 'colorized_image.jpg', 'wb' )
f.write(response.content)
f.close()

An example to colorize one image with all the default values shown (Image subscription)

import requests
url = "https://apis.palette.fm/105esxukgwqbp7g4/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
}
headers = {
"X-BLOBR-KEY": ""
}
response = requests .post(url, files=files, data=data, headers=headers)
f = open( 'colorized_image.jpg', 'wb' )
f.write(response.content)
f.close()

A javascript function assuming a user has uploaded an image

async function colorizeImage() {
const url = "https://apis.palette.fm/105esxukgwqbp7g4/colorize_image_with_auto_prompt";
const inputImage = document.querySelector('#inputImage'); // Assuming you have an input with id 'inputImage' for selecting the image file.
const imageFile = inputImage.files[0];
const formData = new FormData();
formData.append('image', imageFile, 'black_and_white.jpg');
formData.append('resolution', 'watermarked-sd');
formData.append('prompt', '');
formData.append('standard_filter_id', '1');
formData.append('artistic_filter_id', 'O');
formData.append('raw_captions', 'false');
formData.append('pre_fix', '');
formData.append('post_fix', '');
formData.append('auto_color', 'true');
formData.append('white_balance', 'false');
formData.append('temperature', '-0.1');
formData.append('saturation', '1.1');
const headers = {
"X-BLOBR-KEY": ""
};
try {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: formData
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const blob = await response.blob();
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'colorized_image.jpg';
a.click();
} catch (error) {
console.error('Error fetching the image:', error);
}
}