Relighting

Prompts to auto-magically relight your images.

~31.18s
~$0.037
 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

POSThttps://api.segmind.com/v1/ic-light

Parameters

promptrequired
string

A text description guiding the relighting and generation process

Default: "cat, photoshoot, 4k"
subject_imagerequired
string (uri)

The main foreground image to be relighted

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg"
appended_promptoptional
string

Additional text to be appended to the main prompt, enhancing image quality

Default: "best quality"
cfgoptional
number

Classifier-Free Guidance scale - higher values encourage adherence to prompt, lower values encourage more creative interpretation

Default: 2Range: 1 - 32
heightoptional
integer

An enumeration.

Default: 640
Allowed values (13 total):
256320384448512576640704768832+3 more
highres_denoiseoptional
number

Controls the amount of denoising applied when refining the high resolution output (higher = more adherence to the upscaled latent, lower = more creative details added)

Default: 0.5Range: 0.1 - 1
highres_scaleoptional
number

The multiplier for the final output resolution relative to the initial latent resolution

Default: 1.5Range: 1 - 3
light_sourceoptional
string

An enumeration.

Allowed values :
"None""Left Light""Right Light""Top Light""Bottom Light"
lowres_denoiseoptional
number

Controls the amount of denoising applied when generating the initial latent from the background image (higher = more adherence to the background, lower = more creative interpretation)

Default: 0.9Range: 0.1 - 1
negative_promptoptional
string

A text description of attributes to avoid in the generated images

Default: "lowres, bad anatomy, bad hands, cropped, worst quality"
number_of_imagesoptional
integer

The number of unique images to generate from the given input and settings

Default: 1Range: 1 - 12
output_formatoptional
string

An enumeration.

Default: "webp"
Allowed values :
"webp""jpg""png"
output_qualityoptional
integer

The image compression quality (for lossy formats like JPEG and WebP). 100 = best quality, 0 = lowest quality.

Default: 80Range: 0 - 100
seedoptional
integer

A fixed random seed for reproducible results (omit this parameter for a randomized seed)

Default: 42
stepsoptional
integer

The number of diffusion steps to perform during generation (more steps generally improves image quality but increases processing time)

Default: 25Range: 1 - 100
widthoptional
integer

An enumeration.

Default: 512
Allowed values (13 total):
256320384448512576640704768832+3 more

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out