Skip to content

OutPainting

POST https://api.newportai.com/api/async/outpainting

Outpainting is a feature extended the edges of an image, creating a larger canvas while ensuring a smooth transition between the original image and newly generated areas. It is commonly used to adjust the image to a different aspect ratio or to enhance its overall composition.

  • Use Outpainting API to get taskId with POST method.
  • Use Polling API to get Outpainting result with POST method.

Request Header Parameters

  • Content-TypestringRequired
    Enum
    application/json
  • AuthorizationstringRequired
    Bearer authentication format, for example: Bearer

Request Body Parameters

  • urlstringRequired
    url of the original image, with a maximum resolution of 16 megawpixels and a max file size of 10MB.
  • OutPaintSizeObjectRequired
    Format: { left: int, right: int, top:int, bottom: int }

Response

  • codeinteger
    0 success, or error code.
  • messagestring
    "success", or error msg.
  • dataobject
    taskIdstring
    Use the taskId to request the Polling API to retrieve the generated outputs.

Example

Request:

zsh
curl -X POST 'https://api.newportai.com/api/async/outpainting' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
--data '{
  "url": "https://newportai-api-market.s3.amazonaws.com/demo_image/demo_image.jpg",
  "outPaintSize": {
      "left": 100,
      "right": 100,
      "top": 100,
      "bottom": 100
  }
}'

Response:

json
{
  "code": 0,
  "message": "success", 
  "data": {
    "taskId": "b08337dc08d7428daa64b3d5e61b8350"
  }
}

Next Step:

Use Polling API to get the result.

Demo
before
after