---
title: "Relight - Adjust image lighting"
method: POST
path: "/v1/ai/image-relight"
tags: ["image-relight"]
---

# Relight - Adjust image lighting

`POST /v1/ai/image-relight`

## Request

- Base URL: `https://api.magnific.com`
- URL: `https://api.magnific.com/v1/ai/image-relight`
- Auth: API key in header `x-magnific-api-key`

Relight an image using AI. This endpoint accepts a variety of parameters to customize the generated images.

## Request body

- RelightRequest
  - `webhook_url` string, uri: Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.
  - `image` string, required: Base64 or URL of the 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 or URL of the reference image for light transfer. Incompatible with 'transfer_light_from_lightmap'
  - `transfer_light_from_lightmap` string: Base64 or URL of the lightmap for light transfer. Icompatible with 'transfer_light_from_reference_image'
  - `light_transfer_strength` integer: 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: 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: 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` 'standard' | 'darker_but_realistic' | 'clean' | 'smooth' | 'brighter' | 'contrasted_n_hdr' | 'just_composition'
  - `preserve_details` boolean: 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` RelightRequestAdvancedSettings
    - `whites` integer: Adjust the level of white color in the image. Valid values range `[0, 100]`, default `50`.
    - `blacks` integer: Adjust the level of black color in the image. Valid values range `[0, 100]`, default `50`.
    - `brightness` integer: Adjust the level of brightness in the image. Valid values range `[0, 100]`, default `50`.
    - `contrast` integer: Adjust the level of contrast in the image. Valid values range `[0, 100]`, default `50`.
    - `saturation` integer: Adjust the level of saturation in the image. Valid values range `[0, 100]`, default `50`.
    - `engine` 'automatic' | 'balanced' | 'cool' | 'real' | 'illusio' | 'fairy' | 'colorful_anime' | 'hard_transform' | 'softy': Balanced: Well-rounded, general-purpose option. Cool: Brighter with cooler tones. Real: Aims to enhance photographic quality. Experimental. Illusio: Optimized for illustrations and drawings. Fairy: Suited for fantasy-themed images. Colorful Anime: Ideal for anime, cartoons, and vibrant colors. Hard Transform: Significantly alters the original image. Softy: Slightly softer effect, suitable for graphic designs.
    - `transfer_light_a` 'automatic' | 'low' | 'medium' | 'normal' | 'high' | 'high_on_faces': Adjusts the intensity of light transfer. Advanced feature requiring practice to use effectively.
    - `transfer_light_b` 'automatic' | 'composition' | 'straight' | 'smooth_in' | 'smooth_out' | 'smooth_both' | 'reverse_both' | 'soft_in' | 'soft_out' | 'soft_mid' | 'strong_mid' | 'style_shift' | 'strong_shift': Also modifies light transfer intensity. Can be combined with the previous control for varied effects. Complex to master but offers more control
    - `fixed_generation` boolean: When this option is enabled, using the same settings will consistently produce the same image. Fixed generations are ideal for fine-tuning, as it allows for incremental changes to parameters (such as the prompt) to see subtle variations in the output. When disabled, expect each generation to introduce a degree of randomness, leading to more diverse outcomes.

## Response `200`

OK - The request has succeeded and the relight process has started.

- GetStyleTransferTaskStatus200Response
  - `data` TaskDetail, required
    - `task_id` string, uuid, required: Task identifier
    - `status` 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED', required: Task status
    - `generated` string[], required

## Other responses

- `400`: Bad Request - The server could not understand the request due to invalid syntax.
- `401`: Unauthorized - The client must authenticate itself to get the requested response.
- `500`: Internal Server Error - The server has encountered a situation it doesn't know how to handle.
- `503`: Service Unavailable

---

[API](https://skmtc.dev/magnific/apis/magnific-api.md) · [All operations](https://skmtc.dev/magnific/apis/magnific-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magnific/apis/magnific-api/revisions/60711fb082c7?raw)
