Overview

Relight examples (from top left to bottom right): Original image, Night scene, Snowy landscape, and Hell scene.

Freepik API uses Magnific.ai technology, now available as a comprehensive API service.

Image Relight allows you to change the entire lighting of a scene and, optionally, the background using:

  1. A prompt
  2. A reference image
  3. A light map

This tool can simulate different lighting scenarios, enhance details, and create artistic effects. Our API lets you transform your images with custom prompts and fine-tuned parameters for impressive results.

Image Relight uses Magnific.ai technology, now available as a comprehensive API service.

Looks amazing take me to the code already!

API Reference: Image Relight

Use Cases

The Image Relight can be applied to a wide range of image types and industries, including:

  • Portraits: Change lighting to enhance facial features
  • Product photography: Adjust lighting for better presentation
  • Architectural renderings: Simulate different times of day
  • Film stills: Create dramatic lighting effects
  • Graphic design: Add creative lighting to designs
  • Nature photography: Enhance natural light conditions

Relight an Image

Create a relighting task for an image.

POST /v1/ai/image-relight

Relight an image using AI

Key Parameters

image
string
required

Base64 encoded image to relight

prompt
string

Guide the relighting process. Use descriptive prompts to influence the light transfer (e.g., “A sunlit forest clearing at golden hour”).

Tip: Use weights to emphasize parts of your prompt. Add a number in parentheses (1 to 1.4) after a phrase, like “(dark scene:1.3)“.

Note: Incompatible with ‘transfer_light_from_reference_image’ and ‘transfer_light_from_lightmap’.

transfer_light_from_reference_image
string

Base64 encoded reference image for light transfer.

Note: Incompatible with ‘prompt’ and ‘transfer_light_from_lightmap’.

You must select either ‘prompt’, ‘transfer_light_from_reference_image’, or ‘transfer_light_from_lightmap’. Only one of these parameters should be provided.

transfer_light_from_lightmap
string

Base64 encoded lightmap for light transfer.

Note: Incompatible with ‘prompt’ and ‘transfer_light_from_reference_image’.

light_transfer_strength
integer
default: "100"

Specify the level of light transfer (0 to 100). Lower values keep the image closer to the original, while higher values apply more light transfer.

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.

change_background
boolean
default: "true"

When enabled, it will change the background based on your prompt and/or reference image.

style
string
default: "standard"

Style options for the relighting process:

  • standard: General-purpose relighting
  • darker_but_realistic: Darker tones with realistic lighting
  • clean: Clean and simple lighting
  • smooth: Smooth lighting transitions
  • brighter: Brighter lighting
  • contrasted_n_hdr: High contrast and HDR effect
  • just_composition: Focus on composition without changing lighting
advanced_settings
object

Advanced settings for fine-tuning the relighting process:

  • whites: Adjust the level of white color (0 to 100)
  • blacks: Adjust the level of black color (0 to 100)
  • brightness: Adjust the brightness level (0 to 100)
  • contrast: Adjust the contrast level (0 to 100)
  • saturation: Adjust the saturation level (0 to 100)
  • engine: Choose the relighting engine (automatic, balanced, cool, real, illusio, fairy, colorful_anime, hard_transform, softy)
  • transfer_light_a: Adjust the intensity of light transfer (automatic, low, medium, normal, high, high_on_faces)
  • transfer_light_b: Modify light transfer intensity (automatic, composition, straight, smooth_in, smooth_out, smooth_both, reverse_both, soft_in, soft_out, soft_mid, strong_mid, style_shift, strong_shift)
  • fixed_generation: When enabled, using the same settings will consistently produce the same image.

Selecting Light Transfer Method

Choose one of these three ways to transfer light in Image Relight:

  1. Prompt Describe the desired lighting using text. Specify characteristics like color, time of day, type and shape of light. Example: “A sunlit forest clearing at golden hour” or “Under the water”

  2. Reference Image Provide an image to transfer lighting from. Image Relight will replicate the light, colors, and shadows from this reference.

  3. Lightmap Create custom lighting with your own lightmap image:

    • Black represents absence of light
    • Lighter colors (including white) indicate presence, color, and shape of light sources

API Call Example

curl --request POST \
  --url https://api.freepik.com/v1/ai/image-relight \
  --header 'Content-Type: application/json' \
  --header 'x-freepik-api-key: <YOUR_API_KEY>' \
  --data '{
    "image": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
    "prompt": "A sunlit forest clearing at golden hour",
    "light_transfer_strength": 80,
    "style": "smooth"
  }'

Authentication

Include the x-freepik-api-key header in your requests for authentication. Keep this key secure and don’t share it with others.

Webhook

If you provide a webhook_url, you’ll receive a POST request to that URL when the relighting task is complete. The webhook payload will include the task status and the URL of the relighted image.

Get Relighting Task Status

You can check the status of a relighting task using the task ID returned from the initial request.

GET /v1/ai/image-relight/{task-id}

Get the status of a relighting task

List All Relighting Tasks

Retrieve a list of all your relighting tasks.

GET /v1/ai/image-relight

Get the status of all relighting tasks

Pricing and Usage

Premium Feature: The Image Relight is currently available exclusively for premium API users.

To access the Image Relight feature:

  1. Generate an API key if you haven’t already.
  2. Upgrade your account to a premium plan at the Developers Dashboard.

Once upgraded, you’ll have access to the Image Relight along with other premium features.

Pricing is based on a pay-as-you-go model, with no prepayment or commitment required. You’ll only be charged for the relights you actually perform.

Here is the pricing:

OperationPrice per Unit
Image Relight€0.10

Rate Limiting

Rate limits are 250 relights per day for upgraded accounts. If you need more relights, contact the our team and we will study your case.

Frequently Asked Questions

Need Help?

For questions or custom requirements, contact the Freepik sales team.