GET
/v1/schemas/stability/image/v2beta/stable-image/edit/replace-background-and-relight
Accept:
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace1ea5455da5ce2efef103daa142cc44a3e70b4fb3cfcdfa0c9a6a6f46d93912ea{
"fetchedAt": 1789536057,
"extractorVersion": "1",
"verifiedAt": null
} |
Request body
13 properties · 1 required · 2 $defs| property | type | description | constraints |
|---|---|---|---|
| subject_image* | string | An image containing the subject that you wish to change background and relight. | format: binary |
| background_reference | string | An image whose style you wish to use in the background. Similar to the Control: Style API, stylistic elements from this image are added to the background. | format: binary |
| background_prompt | string | What you wish to see in the background of the output image. This could be a description of the desired background scene, or just a description of the lighting if modifying the light source through `light_source_direction` or `light_reference`. | length ≤ 10000 |
| foreground_prompt | string | Description of the subject. Use this to prevent elements of the background from bleeding into the subject. For example, if you find your subject is turning green with a forest in the background, try putting a short description of the subject in this field. | length ≤ 10000 |
| negative_prompt | string | A blurb of text describing what you **do not** wish to see in the output image. This is an advanced feature. | length ≤ 10000 |
| preserve_original_subject | number | How much to overlay the original subject to exactly match the original image. A 1.0 is an exact pixel match for the subject, and 0.0 is a close match but will have new lighting qualities. This is an advanced feature. | 0 ≤ n ≤ 1 · default: 0.6 |
| original_background_depth | number | Controls the generated background to have the same depth as the original subject image. This is an advanced feature. | 0 ≤ n ≤ 1 · default: 0.5 |
| keep_original_background | enum | Whether to keep the background of the original image. When this is on, the background will have different lighting than the original image that changes based on the other parameters in this API. | true | false · default: "false" |
| light_source_direction | enum | Direction of the light source. | left | right | above | below |
| light_reference | string | An image with the desired lighting. Lighter sections of the light_reference image will correspond to sections with brighter lighting in the output image. | format: binary |
| light_source_strength | number | If using `light_reference_image` or `light_source_direction`, controls the strength of the light source. 1.0 is brighter and 0.0 is dimmer. This is an advanced feature. | 0 ≤ n ≤ 1 · default: 0.3 |
| seed | number | A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) | 0 ≤ n ≤ 4294967294 · default: 0 |
| output_format | enum | Dictates the `content-type` of the generated image. | jpeg | png | webp · default: "png" |
Types
2 $defsNegativePromptstring
A blurb of text describing what you **do not** wish to see in the output image. This is an advanced feature.
length ≤ 10000
Seednumber
A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)
0 ≤ n ≤ 4294967294 · default: 0
Validate a payload
before you spend tokensshell
$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"stability","endpointId":"v2beta/stable-image/edit/replace-background-and-relight","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}