Segmind Relighting V2
Transform images with customizable, photorealistic lighting for unparalleled visual creativity and authenticity.
API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/segmind-relighting-v2"
# Request payload
data = {
"image": "https://segmind-resources.s3.amazonaws.com/output/b9b4e651-ecfb-4dd8-a121-6663f63cca8e-5e23ecbb-6875-4296-9b05-481c03eac5bf.png",
"light_direction": "back",
"light_type": "spotlight",
"light_temperature": "warm",
"light_intensity": "strong",
"size": "auto",
"quality": "high",
"background": "opaque",
"output_compression": 100,
"output_format": "png"
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Provide the URL of the image to be relit. Use a URL from cloud storage like S3.
Set the direction of lighting. For dramatic effects, choose 'back' or 'left'.
Allowed values:
Select the lighting source for desired mood. 'Spotlight' creates a focused beam effect.
Allowed values:
Choose light color to affect mood. 'Warm' is cozy while 'cool' suits tech themes.
Allowed values:
Adjust light brightness. Choose 'strong' for well-lit images and 'mood' for softer settings.
Allowed values:
Determine output resolution. 'Auto' allows the model to decide optimal resolution.
Allowed values:
Set visual quality of the output image. 'High' suits professional needs.
Allowed values:
Select if the image background should be transparent or not; 'opaque' for regular use.
Allowed values:
Adjust compression level. Lower numbers mean smaller file size but risk quality loss.
Decide the format for the output image; 'webp' for balanced quality and size.
Allowed values:
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Resources to get you started
Everything you need to know to get the most out of Segmind Relighting V2
# Quick-Start Guide to Segmind Relighting V2
Segmind Relighting V2 lets you transform your imageâs lighting with simple text prompts. Follow this guide to get photorealistic results for different scenarios.
## 1. Crafting Effective Prompts
Use the dynamic prompt template:
Illuminate the scene with a {light_type} source from the {light_direction}, with {light_temperature} coloration and {light_intensity} brightness. Keep all original elements unaltered.
Fill in the placeholders:
- **light_type**: softbox | sunlight | spotlight | ambient
- **light_direction**: left | right | top | back
- **light_temperature**: warm | cool | neutral | sunset
- **light_intensity**: mood | bright | medium | strong
Example prompts:
- Dramatic portrait:
`Illuminate the scene with a spotlight source from the back, with warm coloration and mood brightness. Keep all original elements unaltered.`
- Product showcase:
`Illuminate the scene with a softbox source from the top, with neutral coloration and bright brightness. Keep all original elements unaltered.`
- Outdoor scene:
`Illuminate the scene with a sunlight source from the left, with sunset coloration and medium brightness. Keep all original elements unaltered.`
## 2. Required Parameters
- **image (URL)**
- **light_direction**
- **light_type**
- **light_temperature**
- **light_intensity**
Ensure your image is accessible via a public cloud URL (e.g., S3).
## 3. Advanced Settings
| Parameter | Description | Recommended Value (Use Case) |
|--------------------|-----------------------------------------------------|-----------------------------------------|
| size | Output resolution | `auto` (web) / `1536x1024` (print) |
| quality | Visual fidelity | `high` (final renders) / `medium` (draft) |
| background | Transparent or opaque background | `transparent` (compositing) / `opaque` (regular) |
| output_format | File format | `webp` (balanced) / `png` (max quality) |
| output_compression | JPEG/WebP compression level (0â100) | `80â90` (web) / `100` (archive) |
### Use-Case Recommendations
- **E-Commerce/Product Catalogs**
- Prompt: softbox + top + neutral + bright
- size: `1024x1024`, quality: `high`, background: `transparent`, format: `png`
- **Digital Art & Portfolios**
- Prompt: spotlight + back + warm + mood
- size: `auto`, quality: `high`, format: `webp`, compression: `85`
- **Film Pre-Visualization**
- Prompt: ambient + right + cool + medium
- size: `1536x1024`, quality: `medium`, format: `jpeg`, compression: `75`
## 4. Batch Processing Tips
1. Maintain consistent prompt parameters across images for uniform lighting.
2. Automate via scriptsâloop over image URLs and apply the same JSON payload.
3. Validate outputs in low-res first (`size: auto`, `quality: medium`), then finalize in high-res.
By fine-tuning your prompts and leveraging advanced parameters, Segmind Relighting V2 will deliver seamless, photorealistic lighting that elevates any visual project.
Other Popular Models
Discover other models you might be interested in.
sdxl-img2img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers

idm-vton
Best-in-class clothing virtual try on in the wild

face-to-many
Turn a face into 3D, emoji, pixel art, video game, claymation or toy

sd2.1-faceswapper
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training
