AI Relight
Overview
The Image Editing API allows you to correct lighting issues, such as over-exposition or under-exposition, by re-lighting the input image.
To re-light an image, set the argument lighting.mode to one of these three values:
ai.autofor the lighting to be automatically adjustedai.preserve-hue-and-saturationfor the lighting to be adjusted while keeping color hues and saturations as close as possible to the original imagethis can be useful for product images, where maintaining color accuracy is important
ai.optimize-portraitfor the lighting to be optimized for human portrait photography. Specifically, this mode acts on the subject by:enhancing light intensity
removing blemishes
applying subtle teeth whitening
preserving freckles and skin characteristics
Please note that AI Relight is currently limited to images with a maximum resolution of 3,500x3,500 pixels.
Known issue: we don't recommend using AI Relight along with AI Expand in a same API call.
Examples
Here are some examples of what re-lighting can achieve by setting lighting.mode=ai.auto:
Original
Re-lighted






If you want to give it a try, here's the code to reproduce the examples above:
And here are examples of the output produced by the different values for lighting.mode, for different use-cases:
Second-hand marketplace
Original
lighting.mode=ai.auto
lighting.mode=ai.preserve-hue-and-saturation















School portraits
Original
lighting.mode=ai.auto
lighting.mode=ai.preserve-hue-and-saturation
lighting.mode=ai.optimize-portrait
























Food industry
Original
lighting.mode=ai.auto
lighting.mode=ai.preserve-hue-and-saturation









Car industry
Original
lighting.mode=ai.auto
lighting.mode=ai.preserve-hue-and-saturation









Luxury industry
Original
lighting.mode=ai.auto
lighting.mode=ai.preserve-hue-and-saturation









Last updated
Was this helpful?