AI Shadows
The Image Editing API allows you to add realistic shadows to the main subject of the input image.
Here's a demo of how you can use AI Shadows to create studio quality product images at scale:
The tool used in the video is available here: https://try-api.photoroom.com/shadows.
This tool will consume API image, we recommend using Sandbox mode if you want to test for free.
New AI Shadows Model
Overview
We've shipped a new model for AI Shadows that gives you complete control over the softness, intensity and position of the shadow.
To use this new model you will need to:
add the HTTP header
pr-ai-shadows-model-version: 2026-04-15to your API callset the parameter
shadow.modetoai.auto-with-overrides
By default, this new model will automatically determine the best values for the softness, intensity and position of the shadow.
However, you also have access to 5 parameters that let you override each of these dimensions, to control the appearance of the shadow:
shadow.softnessOverride, controls whether the shadow will have hard or soft edgesshadow.intensityOverride, controls how dark the shadow will beshadow.spreadOverride, controls how long the shadow will beshadow.directionOverride, controls the direction of the shadow relative to the subjectshadow.subjectPoseOverride, controls whether the subject is laying flat or standing upright
Under-the-hood, these parameters allow you to precisely control how the light source should be positioned relative to the subject:

Preview Tool
We've built a tool that will help you:
easily visualize the impact that each of these override parameters has
define the set of parameter values that will produce the result you're looking for

This tool will consume API image, we recommend using Sandbox mode if you want to test for free.
Auto Mode
When none of the 5 override parameters have been set, the model will fully determine the best shadow appearance for each input image:

shadow.mode=ai.auto-with-overridesThis can be useful because it enables you to immediately start using the feature, without needing to decide on a value for each override parameter
If you want to give it a try, here's the code to reproduce the example above:
If needed, it's also possible to set a value for some of the override parameters, while letting the model determine the value of the others:

shadow.mode=ai.auto-with-overrides
shadow.intensityOverride=0.9
shadow.spreadOverride=shortDeterministic Mode
When all 5 override parameters have been set, the appearance of the shadow becomes fully deterministic.
Doing so enables you to achieve a consistent shadow appearance at scale:

shadow.mode=ai.auto-with-overrides
shadow.softnessOverride=0.3
shadow.intensityOverride=0.8
shadow.spreadOverride=medium
shadow.directionOverride=behindLeft
shadow.subjectPoseOverride=upright
shadow.mode=ai.auto-with-overrides
shadow.softnessOverride=0.3
shadow.intensityOverride=0.8
shadow.spreadOverride=medium
shadow.directionOverride=behindRight
shadow.subjectPoseOverride=uprightIf you want to give it a try, here's the code to reproduce the first example above:
Override Parameters
shadow.softnessOverride
shadow.softnessOverrideControls whether the shadow will have hard or soft edges.
0 means a very hard shadow, 1 means a very soft shadow.



(original image)
shadow.mode=ai.auto-with-overrides
shadow.softnessOverride=0.3
shadow.mode=ai.auto-with-overrides
shadow.softnessOverride=0.7
shadow.intensityOverride
shadow.intensityOverrideControls how dark the shadow will be.
0 means a very faint shadow, 1 means a very dark shadow.



(original image)
shadow.mode=ai.auto-with-overrides
shadow.intensityOverride=0.3
shadow.mode=ai.auto-with-overrides
shadow.intensityOverride=0.7
shadow.spreadOverride
shadow.spreadOverrideControls how long the shadow will be.
Can be provided either as an angle in degrees or as one of the following presets:
short(= 10Β°)medium(= 45Β°)long(= 90Β°)
When using degrees, 0 means a very short shadow and 90 means a very long shadow.
When using a value in degrees, only set a numeric value, do not add the Β° character.
e.g.: 45 is a valid value, 45Β° is not a valid value



(original image)
shadow.mode=ai.auto-with-overrides
shadow.spreadOverride=short
shadow.mode=ai.auto-with-overrides
shadow.spreadOverride=medium
shadow.directionOverride
shadow.directionOverrideControls the direction of the shadow relative to the subject.
Can be provided either as an angle in degrees or as one of the following presets:
behind(= 0Β°)behindLeft(= 45Β°)left(= 90Β°)frontLeft(= 135Β°)front(= 180Β°)frontRight(= 225Β°)right(= 270Β°)behindRight(= 315Β°)
When using degrees:
0means the shadow is behind the subject90means the shadow is at the left of the subject180means the shadow is in front of the subject270means the shadow is at the right of the subject.
When using a value in degrees, only set a numeric value, do not add the Β° character.
e.g.: 45 is a valid value, 45Β° is not a valid value





(original image)
shadow.mode=ai.auto-with-overrides
shadow.directionOverride=behindLeft
shadow.mode=ai.auto-with-overrides
shadow.directionOverride=frontLeft
shadow.mode=ai.auto-with-overrides
shadow.directionOverride=frontRight
shadow.mode=ai.auto-with-overrides
shadow.directionOverride=behindRight
shadow.subjectPoseOverride
shadow.subjectPoseOverrideControls whether the subject is laying flat or standing upright.
Can be provided either as an angle in degrees or as one of the following presets:
flatlay(= 0Β°)upright(= 90Β°)
When using degrees, 0 means the subject is laying flat and 90 means the subject is placed upright.
When using a value in degrees, only set a numeric value, do not add the Β° character.
e.g.: 45 is a valid value, 45Β° is not a valid value



(original image)
shadow.mode=ai.auto-with-overrides
shadow.subjectPoseOverride=flatlay
shadow.mode=ai.auto-with-overrides
shadow.subjectPoseOverride=upright
Previous AI Shadows Model
To add a realistic shadow, set the argument shadow.mode with one of the following values:




(original image)
shadow.mode=ai.soft
shadow.mode=ai.hard
shadow.mode=ai.floating
If you've also added an AI Background to your image, then it's not recommended to also add an AI Shadow as the generated background will already include a shadow for the subject.
If you want to give it a try, here's the code to reproduce the examples above:
Last updated
Was this helpful?