POST
/
v3
/
outpainting
curl --request POST \
  --url https://api.novita.ai/v3/outpainting \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "extra": {
    "response_image_type": "<string>",
    "enterprise_plan": {
      "enabled": true
    }
  },
  "image_file": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 123,
  "height": 123,
  "center_x": 123,
  "center_y": 123
}'
{
  "image_file": "<string>",
  "image_type": "<string>"
}

Extending the borders of the image or providing additional variations to the edges of the image.

Request Headers

Content-Type
string
required

Enum: application/json

Authorization
string
required

Bearer authentication format, for example: Bearer {{API Key}}.

Request Body

extra
object

Optional extra parameters for the request.

image_file
string
required

The base64 original image, with a maximum resolution of 1024 x 1024 and a maximum file size of 30 Mb.

prompt
string
required

Text input required to guide the image generation, divided by , . Range [1, 1024].

negative_prompt
string

Text input that specifies what to exclude from the generated images, divided by , . Range [1, 1024].

width
integer
required

The width of the outpainting image (px), which needs to be larger than the width of the original image. Maximum: 4096px.

height
integer
required

The height of the outpainting image (px), which needs to be larger than the height of the original image. Maximum: 4096px.

center_x
integer
required

The offset (px) between the center of the original image and the center of the expanded image in the X-axis direction. Default is 0. The allowed value range is -(width + original image width)/2 to (width + original image width)/2.

center_y
integer
required

The offset (px) between the center of the original image and the center of the expanded image in the Y-axis direction. Default is 0. The allowed value range is -(height + original image height)/2 to (height + original image height)/2.

Response

image_file
string

The Base64-encoded content of the returned image.

image_type
string

The returned image type.
Enum: png, webp, jpeg

Example

Extending the borders of the image or providing additional variations to the edges of the image.

Try it in playground.

Request:

curl --location --request POST 'https://api.novita.ai/v3/outpainting' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"image_file":"{{Base64 encoded image}}",
"width": 1024,
"height": 1024,
"center_x": 0,
"center_y": 0
}'

HTTP status codes in the 2xx range indicate that the request has been successfully accepted. A code 400 means there is a request parameter error, while status codes in the 5xx range indicate internal server errors.

You can obtain the image URL in the image_file of the response in base64 format.

Response:

{
    "image_file": "{{Base64 encoded image}}",
    "image_type": "png"
}