Segmind Relighting V2
Transform images with customizable, photorealistic lighting for unparalleled visual creativity and authenticity.
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) 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
https://api.segmind.com/v1/segmind-relighting-v2Parameters
imagerequiredstring (uri)Provide the URL of the image to be relit. Use a URL from cloud storage like S3.
light_directionrequiredstringSet the direction of lighting. For dramatic effects, choose 'back' or 'left'.
"back""left""right""top""back"light_intensityrequiredstringAdjust light brightness. Choose 'strong' for well-lit images and 'mood' for softer settings.
"strong""mood""bright""medium""strong"light_temperaturerequiredstringChoose light color to affect mood. 'Warm' is cozy while 'cool' suits tech themes.
"warm""warm""cool""neutral""sunset"light_typerequiredstringSelect the lighting source for desired mood. 'Spotlight' creates a focused beam effect.
"spotlight""softbox""sunlight""spotlight""ambient"backgroundoptionalstringSelect if the image background should be transparent or not; 'opaque' for regular use.
"opaque""transparent""opaque"output_compressionoptionalintegerAdjust compression level. Lower numbers mean smaller file size but risk quality loss.
100output_formatoptionalstringDecide the format for the output image; 'webp' for balanced quality and size.
"png""png""jpeg""webp"qualityoptionalstringSet visual quality of the output image. 'High' suits professional needs.
"high""low""medium""high"sizeoptionalstringDetermine output resolution. 'Auto' allows the model to decide optimal resolution.
"auto""1024x1024""1536x1024""1024x1536""auto"use_case_configoptionalstringResponse 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