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.

POST
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
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


imagestr *

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


light_directionenum:str *

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

Allowed values:


light_typeenum:str *

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

Allowed values:


light_temperatureenum:str *

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

Allowed values:


light_intensityenum:str *

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

Allowed values:


sizeenum:str ( default: auto ) Affects Pricing

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

Allowed values:


qualityenum:str ( default: high ) Affects Pricing

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

Allowed values:


backgroundenum:str ( default: opaque )

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

Allowed values:


output_compressionint ( default: 100 )

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


output_formatenum:str ( default: png )

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

Allowed values:


use_case_configundefined ( default: 1 )

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.

Cookie settings

We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept all", you consent to our use of cookies.