POST
javascript
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 41 42 43 44 45 46 47 48 49 50 51 const axios = require('axios'); const FormData = require('form-data'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/ic-light"; const reqBody = { "cfg": 2, "seed": 42, "steps": 25, "width": 512, "height": 640, "prompt": "cat, photoshoot, 4k", "light_source": "None", "highres_scale": 1.5, "output_format": "webp", "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ic-lighting-input.jpeg", "lowres_denoise": 0.9, "output_quality": 80, "appended_prompt": "best quality", "highres_denoise": 0.5, "negative_prompt": "lowres, bad anatomy, bad hands, cropped, worst quality", "number_of_images": 1 }; (async function() { try { const formData = new FormData(); // Append regular fields for (const key in reqBody) { if (reqBody.hasOwnProperty(key)) { formData.append(key, reqBody[key]); } } // Convert and append images as Base64 if necessary const response = await axios.post(url, formData, { headers: { 'x-api-key': api_key, ...formData.getHeaders() } }); console.log(response.data); } catch (error) { console.error('Error:', error.response ? error.response.data : error.message); } })();
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


cfgfloat ( default: 2 )

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

min : 1,

max : 32


seedint ( default: 42 )

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


stepsint ( default: 25 )

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

min : 1,

max : 100


widthenum:int ( default: 512 )

An enumeration.

Allowed values:


heightenum:int ( default: 640 )

An enumeration.

Allowed values:


promptstr *

A text description guiding the relighting and generation process


light_sourceenum:str ( default: None )

An enumeration.

Allowed values:


highres_scalefloat ( default: 1.5 )

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

min : 1,

max : 3


output_formatenum:str ( default: webp )

An enumeration.

Allowed values:


subject_imagestr *

The main foreground image to be relighted


lowres_denoisefloat ( default: 0.9 )

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)

min : 0.1,

max : 1


output_qualityint ( default: 80 )

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

min : 0,

max : 100


appended_promptstr ( default: best quality )

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


highres_denoisefloat ( default: 0.5 )

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

min : 0.1,

max : 1


negative_promptstr ( default: lowres, bad anatomy, bad hands, cropped, worst quality )

A text description of attributes to avoid in the generated images


number_of_imagesint ( default: 1 )

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

min : 1,

max : 12

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.

Relighting

Relighting transforms image illumination with unparalleled control and realism. Relighting model is based on IC-Light, short for "Imposing Consistent Light," leverages cutting-edge AI to manipulate lighting within your images, ensuring seamless integration with existing light conditions.

Text-Driven Illumination Control: Imagine effortlessly adjusting the lighting in your photos using simple text prompts. Relighting model operates as a text-conditioned relighting model, allowing you to specify the desired lighting direction – left, right, top, or bottom. With this intuitive interface, you can instantly relight your images, creating dramatic shadows, adding warmth, or creating a bright and airy feel.

Realism at its Finest: Relighting model goes beyond basic manipulation. The underlying AI models are meticulously trained to understand the physics of light, ensuring that relit images maintain a natural and believable appearance. This translates to seamless merging with existing lighting conditions within the image, eliminating awkward transitions or unrealistic shadows.

Benefits of Relighting in AI Photo Editing

  • Effortless Lighting Control: Text-based prompts provide a user-friendly way to adjust image illumination, empowering even non-technical users to achieve stunning results.

  • Unparalleled Realism: Relighting model leverages advanced AI, trained on real-world lighting scenarios, to produce photorealistic relighting effects.

  • Enhanced Image Storytelling: With the ability to manipulate lighting, Relighting unlocks a world of creative possibilities. Craft specific moods and atmospheres, emphasize key elements, or simply add a touch of artistic flair to your images.

  • Increased Efficiency: Eliminate time-consuming manual editing processes. Relighting automates relighting, allowing you to focus on the creative aspects of image manipulation.

Whether you're a professional photographer, a creative hobbyist, or simply looking to enhance your existing photos, Relighting provides the tools to bring your vision to life.