docs
APIs
Relighting

Relighting


POST https://sdk.beeble.ai/v1/relight-image

Relight image with your own lighting.
It typically delivers the best performance when used with portrait images.

Request

Authentication


Requests are authenticated with an API key. You need x-api-key header of your request.
Example: x-api-key: YOUR_API_KEY

Body

source_image
string($binary)
The source image to relight.
Please upload the file as a part of the form data. Supported formats include .jpg, .png, and .webp. Images up to 2048x2048 resolution are accepted; images with higher resolution will be downscaled accordingly.
lighting_image
string($binary)
The lighting reference image for relighting
Please upload the file as a part of the form data. Supported formats include .exr and .hdr. Images up to 4k resolution are accepted; However, images with more than 64(w)x32(h) resolution will be downscaled accordingly, resulting in the same relighting performance. Thus, we recommend to use low resolution images to reduce network latency.
lighting_strength
number
The strength of lighting reference image
It determines the intensity of the lighting image to be applied during relighting. Larger values will result in brighter images. Typically, use values ranging from 0.5 to 3.0, depending on the brightness of your lighting_image.
Default: 1.0
lighting_rotation_theta
number
The rotation theta of lighting reference image: vertical direction
It determines the vertical rotation of the lighting reference image. Values can range from 0 to 180. It corresponds to the value in the SwitchLight web editor. We recommend experimenting with the editor to adjust the lighting direction appropriately.
Default: 90.0
lighting_rotation_phi
number
The rotation phi of lighting reference image: horizontal direction
It determines the horizontal rotation of the lighting reference image. Values can range from 0 to 360. It corresponds to the value in the SwitchLight web editor. We recommend experimenting with the editor to adjust the lighting direction appropriately.
Default: 90.0
auto_key
bool
Indicates whether AI automatically remove the background.
If true, the AI automatically remove the background. If false, the alpha channel in the source_image is used to remove the background. However, if the source_image does not have an alpha channel, the AI still automatically remove the background.
Default: true
preview
bool
Indicates whether a low-resolution preview output should be provided.
If true, an output of 512x512 resolution or lower will be deliverd at a higher speed, and 0.5 credit will be charged. If false, an output with a high-resolution up to 2048x2048 will be delieverd, and 1 credit will be charged.
Default: false

Response

Body

OK
200
Returns relit image. (image/png)

Example Usage

For those who are not familiar with using API, we recommend using Postman (opens in a new tab).


curl --request POST \
  --url https://sdk.beeble.ai/v1/relight-image \
  --header 'x-api-key: YOUR_API_KEY' \
  --form source_image=@original.jpg \
  --form lighting_image=@lighting.exr \
  --form lighting_strength=1.0 \
  --form lighting_rotation_theta=90.0 \
  --form lighting_rotation_phi=90.0 \
  --form auto_key=true \
  --form preview=false \
  -o result.png # Remove if the image is broken; error will show.

Examples of input and output


Source Image
source_image
Lighting Image
lighting_image
Result Image
result

Support

Any question? Contact us at info@beeble.ai or join our Discord channel (opens in a new tab).