Relighting
Prompts to auto-magically relight your images.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/ic-light"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "cfg": 2,
12 "seed": 42,
13 "steps": 25,
14 "width": 512,
15 "height": 640,
16 "prompt": "cat, photoshoot, 4k",
17 "highres_scale": 1.5,
18 "output_format": "webp",
19 "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg",
20 "lowres_denoise": 0.9,
21 "output_quality": 80,
22 "appended_prompt": "best quality",
23 "highres_denoise": 0.5,
24 "negative_prompt": "lowres, bad anatomy, bad hands, cropped, worst quality",
25 "number_of_images": 1
26}
27
28response = requests.post(url, headers=headers, json=data)
29
30if response.status_code == 200:
31 result = response.json()
32 print(json.dumps(result, indent=2))
33else:
34 print(f"Error: {response.status_code}")
35 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/ic-light"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "cfg": 2,
12 "seed": 42,
13 "steps": 25,
14 "width": 512,
15 "height": 640,
16 "prompt": "cat, photoshoot, 4k",
17 "highres_scale": 1.5,
18 "output_format": "webp",
19 "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg",
20 "lowres_denoise": 0.9,
21 "output_quality": 80,
22 "appended_prompt": "best quality",
23 "highres_denoise": 0.5,
24 "negative_prompt": "lowres, bad anatomy, bad hands, cropped, worst quality",
25 "number_of_images": 1
26}
27
28response = requests.post(url, headers=headers, json=data)
29
30if response.status_code == 200:
31 result = response.json()
32 print(json.dumps(result, indent=2))
33else:
34 print(f"Error: {response.status_code}")
35 print(response.text)API Endpoint
https://api.segmind.com/v1/ic-lightParameters
promptrequiredstringA text description guiding the relighting and generation process
"cat, photoshoot, 4k"subject_imagerequiredstring (uri)The main foreground image to be relighted
"https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg"appended_promptoptionalstringAdditional text to be appended to the main prompt, enhancing image quality
"best quality"cfgoptionalnumberClassifier-Free Guidance scale - higher values encourage adherence to prompt, lower values encourage more creative interpretation
2Range: 1 - 32heightoptionalintegerAn enumeration.
640256320384448512576640704768832+3 morehighres_denoiseoptionalnumberControls the amount of denoising applied when refining the high resolution output (higher = more adherence to the upscaled latent, lower = more creative details added)
0.5Range: 0.1 - 1highres_scaleoptionalnumberThe multiplier for the final output resolution relative to the initial latent resolution
1.5Range: 1 - 3light_sourceoptionalstringAn enumeration.
"None""Left Light""Right Light""Top Light""Bottom Light"lowres_denoiseoptionalnumberControls the amount of denoising applied when generating the initial latent from the background image (higher = more adherence to the background, lower = more creative interpretation)
0.9Range: 0.1 - 1negative_promptoptionalstringA text description of attributes to avoid in the generated images
"lowres, bad anatomy, bad hands, cropped, worst quality"number_of_imagesoptionalintegerThe number of unique images to generate from the given input and settings
1Range: 1 - 12output_formatoptionalstringAn enumeration.
"webp""webp""jpg""png"output_qualityoptionalintegerThe image compression quality (for lossy formats like JPEG and WebP). 100 = best quality, 0 = lowest quality.
80Range: 0 - 100seedoptionalintegerA fixed random seed for reproducible results (omit this parameter for a randomized seed)
42stepsoptionalintegerThe number of diffusion steps to perform during generation (more steps generally improves image quality but increases processing time)
25Range: 1 - 100widthoptionalintegerAn enumeration.
512256320384448512576640704768832+3 moreResponse Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out