stable-image/inpaint
Inpaint an existing image, with or without a mask, using our latest-and-greatest inpainting model.
Search-and-Replace Mode
This mode is ideal for individuals of all levels of skill in design. It can be used for straightforward
adjustments to images. The service will automatically mask the most appropriate object based on the contents
of the search_prompt, and replace it with a generated result based on the prompt.
How to use: set the mode parameter to search and provide a short description of what to
search-and-replace in the search_prompt parameter.
Mask Mode
This mode allows for precise control of generative fill tasks on an image, down to the level of
individual pixels. Design professionals can provide a mask for the section of the image to be replaced,
and use standard image prompting to describe the full image as it should appear after the editing.
The resulting image will incorporate all of the elements described in the prompt.
How to use: set the mode parameter to mask and either pass in an image with an alpha channel
or provide an explicit mask image to the mask parameter. If both are present the mask parameter will
take precedence.
Price
- Requests with
modeset tosearchcost 4 cents. - Requests with
modeset tomaskcost 3 cents.
Authorizations
Use your Stability API key to authentication requests to this App.
Headers
Your Stability API key, used to authenticate your requests. Although you may have multiple keys in your account, you should use the same key for all requests to this API.
1The content type of the request body. Do not manually specify this header; your HTTP client library will automatically include the appropriate boundary parameter.
1"multipart/form-data"
Specify image/* to get the image bytes directly. Otherwise specify application/json to receive the image as base64 encoded JSON.
image/*, application/json Body
- Option 1
- Option 2
Controls how the model decides which areas to inpaint and which areas to leave alone.
Specifying mask requires:
- Provide an explicit mask image in the
maskparameter - Use the alpha channel of the
imageparameter as the mask
Specifying search requires:
- Provide a small description of what to inpaint in the
search_promptparameter
search Short description of what to inpaint in the image.
"glasses"
The image you wish to inpaint.
Supported Formats:
- jpeg
- png
- webp
Validation Rules:
- Every side must be at least 64 pixels
- Total pixel count must be between 4,096 and 9,437,184 pixels
What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.
To control the weight of a given word use the format (word:weight),
where word is the word you'd like to control the weight of and weight
is a value between 0 and 1. For example: The sky was a crisp (blue:0.3) and (green:0.8)
would convey a sky that was blue and green, but more green than blue.
1 - 10000A blurb of text describing what you do not wish to see in the output image. This is an advanced feature.
10000A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass 0 to use a random seed.)
0 <= x <= 4294967294Dictates the content-type of the generated image.
jpeg, png, webp Response
Inpainting was successful.
The bytes of the generated image.
The finish-reason and seed will be present as headers.