AI Relighting

If your image has been underexposed or overexposed, the Image Editing API enables you to fix this issue by re-lighting the image.

To re-light an image, set the argument lighting.mode to either the value:

  • ai.auto for the lighting to be automatically adjusted

  • ai.preserve-hue-and-saturation for the lighting to be adjusted while keeping color hues and saturations as close as possible to the original image

    • this can be useful for product images, where maintaining color accuracy is important

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:

curl 'https://image-api.photoroom.com/v2/edit?referenceBox=originalImage&maxWidth=2000&maxHeight=2000&removeBackground=false&lighting.mode=ai.auto&imageUrl=URL_OF_YOUR_IMAGE' \
--header 'x-api-key: YOUR_API_KEY' \
--output with-re-lighting.png

And here are examples of the output produced by the different values for lighting.mode:

Original

lighting.mode=ai.auto

lighting.mode=ai.preserve-hue-and-saturation

Last updated

Was this helpful?