Erase
The Erase service removes unwanted objects, such as blemishes on portraits or items on desks, using image masks.
The mask is provided in one of two ways:
- Explicitly passing in a separate image via the
maskparameter - Derived from the alpha channel of the
imageparameter.
How to use
Please invoke this endpoint with a POST request.
The headers of the request must include an API key in the authorization field. The body of the request must be
multipart/form-data, and the accept header should be set to one of the following:
image/*to receive the image in the format specified by theoutput_formatparameter.application/jsonto receive the image encoded as base64 in a JSON response.
The body of the request must include:
image
Optionally, the body of the request may also include:
maskseedoutput_format
Note: for more details about these parameters please see the request schema below.
Output
The resolution of the generated image will be 4 megapixels.
Credits
Flat rate of 5 credits per successful generation. You will not be charged for failed generations.
Authorizations
Your Stability API key, sent as a bearer token in the Authorization header.
Headers
Body
Controls the strength of the inpainting process on a per-pixel basis, either via a
second image (passed into this parameter) or via the alpha channel of the image parameter.
Passing in a Mask
The image passed to this parameter should be a black and white image that represents, at any pixel, the strength of inpainting based on how dark or light the given pixel is. Completely black pixels represent no inpainting strength while completely white pixels represent maximum strength.
In the event the mask is a different size than the image parameter, it will be automatically resized.
Alpha Channel Support
If you don't provide an explicit mask, one will be derived from the alpha channel of the image parameter.
Transparent pixels will be inpainted while opaque pixels will be preserved.
In the event an image with an alpha channel is provided along with a mask, the mask will take precedence.
Grows the edges of the mask outward in all directions by the specified number of pixels. The expanded area around the mask will be blurred, which can help smooth the transition between inpainted content and the original image.
Try this parameter if you notice seams or rough edges around the inpainted content.
Note: Excessive growth may obscure fine details in the mask and/or merge nearby masked regions.
0 <= x <= 20Response
Erase was successful.
The bytes of the generated image.
The finish-reason and seed will be present as headers.