POST
/
v1
/
ai
/
image-relight
curl --request POST \
  --url https://api.freepik.com/v1/ai/image-relight \
  --header 'Content-Type: <content-type>' \
  --header 'x-freepik-api-key: <api-key>' \
  --data '{
  "image": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
  "prompt": "A sunlit forest clearing at golden hour",
  "transfer_light_from_reference_image": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
  "light_transfer_strength": 100,
  "interpolate_from_original": false,
  "change_background": true,
  "style": "smooth",
  "advanced_settings": {
    "whites": 60,
    "blacks": 60,
    "brightness": 30,
    "contrast": 40,
    "saturation": 50,
    "engine": "illusio",
    "transfer_light_a": "low",
    "transfer_light_b": "soft_in",
    "fixed_generation": true
  }
}'
{
  "data": {
    "generated": [
      "https://openapi-generator.tech",
      "https://openapi-generator.tech"
    ],
    "task_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
    "status": "IN_PROGRESS"
  }
}

Important

Upscaler endpoints are only available for premium API users. You can upgrade your account here.

Request

Authorizations

x-freepik-api-key
string
headerrequired

Your Freepik API key. Required for authentication. Learn how to obtain an API key

Headers

Content-Type
string
required

The Content-Type header must be set to application/json to indicate that the payload is formatted as JSON. If a different Content-Type is provided, the payload will be ignored, and the request will proceed without processing the body.

Body

application/json
webhook_url
string

Webhook URL to receive the relight image once it's ready

image
string
required

Base64 image to do the relight

prompt
string

You can guide the generation process and influence the light transfer with a descriptive prompt. For example, if the reference image is a brightly lit scene, adding something like "A sunlit forest clearing at golden hour" will be helpful.

You can also use your imagination to alter lighting conditions in images: transforming a daytime scene into a moonlit night, enhancing the warmth of a sunset, or even dramatic changes like casting shadows of towering structures across a cityscape.

IMPORTANT: You can emphasize specific aspects of the light in your prompt by using a number in parentheses, ranging from 1 to 1.4, like "(dark scene:1.3)".

transfer_light_from_reference_image
string

Base64 Reference image for light transfer. Incompatible with 'transfer_light_from_lightmap'

transfer_light_from_lightmap
string

Base64 Lightmap for light transfer. Icompatible with 'transfer_light_from_reference_image'

light_transfer_strength
integer
default: 100

It allows you to specify the level of light transfer, meaning the intensity that your prompt, reference image, or lightmap will have. A value of 0% will keep your image closest to the original, while 100% represents the maximum possible light transfer.

If you enable "Interpolate from original", lower values on this slider will make the result even more similar to your original image. Valid values range [0, 100], default 100

interpolate_from_original
boolean
default: false

When enabled, this feature will make your final image interpolate from the original using the "Light transfer strength" slider, at the cost of sometimes restricting the generation's freedom.

If disabled, the generation will be freer and will generally produce better results. However, for example, if you want to generate all the frames of a video where a room transitions from having the lights off and very dim lighting to gradually becoming fully illuminated as a new day begins, activating this option might be useful (together with gradually ingreasing the "Light transfer strength" slider).

change_background
boolean
default: true

When enabled, it will change the background based on your prompt and/or reference image. This is super useful for product placement and portraits. However, don’t forget to disable it if your scene is something like a landscape or an interior.

style
enum<string>
default: standard
Available options:
standard,
darker_but_realistic,
clean,
smooth,
brighter,
contrasted_n_hdr,
just_composition
preserve_details
boolean
default: true

It will try to maintain the texture and small details of the original image. Especially good for product photography, texts, etc. Disable it if you prefer a smoother result.

advanced_settings
object

Response

200 - application/json
data
object
required