Segmind Relighting V2

Transform images with customizable, photorealistic lighting for unparalleled visual creativity and authenticity.

~77.40s
$0.033 - $0.333 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/segmind-relighting-v2"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "image": "https://segmind-resources.s3.amazonaws.com/output/b9b4e651-ecfb-4dd8-a121-6663f63cca8e-5e23ecbb-6875-4296-9b05-481c03eac5bf.png",
12    "light_direction": "back",
13    "light_type": "spotlight",
14    "light_temperature": "warm",
15    "light_intensity": "strong",
16    "size": "auto",
17    "quality": "high",
18    "background": "opaque",
19    "output_compression": 100,
20    "output_format": "png"
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26    result = response.json()
27    print(json.dumps(result, indent=2))
28else:
29    print(f"Error: {response.status_code}")
30    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/segmind-relighting-v2

Parameters

imagerequired
string (uri)

Provide the URL of the image to be relit. Use a URL from cloud storage like S3.

light_directionrequired
string

Set the direction of lighting. For dramatic effects, choose 'back' or 'left'.

Default: "back"
Allowed values :
"left""right""top""back"
light_intensityrequired
string

Adjust light brightness. Choose 'strong' for well-lit images and 'mood' for softer settings.

Default: "strong"
Allowed values :
"mood""bright""medium""strong"
light_temperaturerequired
string

Choose light color to affect mood. 'Warm' is cozy while 'cool' suits tech themes.

Default: "warm"
Allowed values :
"warm""cool""neutral""sunset"
light_typerequired
string

Select the lighting source for desired mood. 'Spotlight' creates a focused beam effect.

Default: "spotlight"
Allowed values :
"softbox""sunlight""spotlight""ambient"
backgroundoptional
string

Select if the image background should be transparent or not; 'opaque' for regular use.

Default: "opaque"
Allowed values :
"transparent""opaque"
output_compressionoptional
integer

Adjust compression level. Lower numbers mean smaller file size but risk quality loss.

Default: 100
output_formatoptional
string

Decide the format for the output image; 'webp' for balanced quality and size.

Default: "png"
Allowed values :
"png""jpeg""webp"
qualityoptional
string

Set visual quality of the output image. 'High' suits professional needs.

Default: "high"
Allowed values :
"low""medium""high"
sizeoptional
string

Determine output resolution. 'Auto' allows the model to decide optimal resolution.

Default: "auto"
Allowed values :
"1024x1024""1536x1024""1024x1536""auto"
use_case_configoptional
string

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