Image2Image / Inpainting

Inpaint Image

The Inpainting service offers inpainting (image2Image) capabilities, enabling users to fill or replace areas within an image based on specified criteria. It operates in two modes: * Single Image Mode: Submit one RGBA image. The API fills the specified inner area with content based on the prompt parameter. * Mask Mode: Along with the RGBA image, provide a mask of identical size and format. The API uses this mask to identify areas for inpainting with content determined by the prompt parameter.

post/painting/inpaint

Request

  • Base URL
    https://genai-api.picsart.io/v1
  • URL
    https://genai-api.picsart.io/v1/painting/inpaint
  • Auth
    API key in header X-Picsart-API-Key

Request body multipart/form-data

imagestring binary

Source image file (binary). (If this parameter is present, the other image source parameters must be empty.)

image_urlstring uri

Source image URL. (If this parameter is present, the other image source parameters must be empty.)

image_idstring

Deprecated. Source image ID of an image previously uploaded to Picsart or result image ID from a different API. (If this parameter is present, the other image source parameters must be empty.)

mask_imagestring binary

Source mask file (binary). (If this parameter is present, the other mask source parameters must be empty.)

mask_image_urlstring uri

Source mask URL. (If this parameter is present, the other mask source parameters must be empty.)

mask_image_idstring

Deprecated. Source mask ID of an mask previously uploaded to Picsart or result mask ID from a different API. (If this parameter is present, the other mask source parameters must be empty.)

promptstring required

The prompt.

countinteger

The number of images to generate.

format'JPG' | 'PNG' | 'WEBP'

Optionally select one of the image formats (JPG is default). Options are as follows:

  • JPG
  • PNG
  • WEBP
mode'sync' | 'async'

Deprecated. The mode parameter is now deprecated. To control synchronous vs asynchronous execution, use the standard HTTP Prefer header (RFC 7240). If both mode and Prefer are provided, Prefer takes precedence. For migration guidance and examples, see the Sync and Async Execution guide. Use this query parameter to establish the processing mode. Acceptable values are sync, async and auto (sync is default):

  • sync: issues a synchronous request, response is given when the result is ready.
  • async: forces an asynchronous request, the response, which is instantaneous, contains a "transaction_id" which is used to poll for the result.
  • REMOVED - auto: the processing mode decision is made by the service, which depends upon the expected processing time.

Example request

{
  "count": 2
}

Response

Success.

statusstring

Changes

No recorded changes to this operation across all 1 revision of this API.