Skip to main content

Relighting Endpoint

Overview

This endpoint helps to create lighting around image

Request

--request POST 'https://modelslab.com/api/v6/image_editing/relighting' \

Make a POST request to https://modelslab.com/api/v6/image_editing/relighting endpoint and pass the required parameters as a request body to the endpoint.

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorizationstring
promptText prompt describing the content you want in the generated imagestring
negative_promptItems you do not want in the imagestring
init_imageLink or valid base64 data of the image you want your generations to resembledata:image/jpeg;base64,{your_base64_string}
widthWidth of the generated image. Maximum dimension: 1024 x 1024 pixelsinteger
heightHeight of the generated image. Maximum dimension: 1024 x 1024 pixelsinteger
lightingHow the lighting should be placednone, left, right, top, bottom
guidance_scaleScale for classifier-free guidance. Minimum: 1, Maximum: 20. Default: 7integer
highres_scaleHigh-resolution scale. Default: 1.5float
lowres_denoiseLow-resolution denoise. Default: 0.9 (max: 1)float
highres_denoiseHigh-resolution denoise. Default: 0.5 (max: 1)float
num_inference_stepsNumber of denoising steps. Default: 20, Maximum: 50integer
base64Set to true if the provided image is in base64 format or if you want generated images as base64 stringTRUE or FALSE
seedSeed used to reproduce results. Pass null for a random number.integral value
samplesNumber of images to be returned in response. Maximum value is 2integer (max: 2)
webhookURL to receive a POST API call once the image generation is completeURL
track_idID returned in the response to the webhook API call, used to identify the webhook requestintegral value

Example

Body

Body
{
"key":"",
"init_image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": null
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key":"",
"init_image":"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"prompt": "woman, detailed, neon lighting",
"height": 512,
"width": 1024,
"samples":1,
"base64":false,
"webhook": null,
"track_id": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v6/image_editing/relighting", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

Example Response

{
"status": "success",
"generationTime": 7.328356504440308,
"id": 67,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/f5a759d2-9af0-4965-8894-7e4433ee76e9-0.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/f5a759d2-9af0-4965-8894-7e4433ee76e9-0.png"
],
"meta": {
"base64": "no",
"file_prefix": "f5a759d2-9af0-4965-8894-7e4433ee76e9",
"guidance_scale": 7,
"height": 512,
"highres_denoise": 0.5,
"highres_scale": 1.5,
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/e7d2dd6f-9482-40df-a910-89cc4de2e7b6-0.png",
"lighting": "right",
"lowres_denoise": 0.9,
"negative_prompt": "low quality",
"num_inference_steps": 20,
"outdir": "out",
"prompt": "woman, detailed, neon lighting",
"samples": 1,
"seed": -1,
"temp": "no",
"width": 1024
}
}