---
title: "Expand Image"
method: POST
path: "/image_expansion"
tags: ["Image Editing"]
---

# Expand Image

`POST /image_expansion`

**Description**


The *Image Expension Route* can be used to expand an image, by utilizing generative AI.

You can decide on the image size of the final result as well as the position and size of the original image compared to the final result.

In this way, you can create unique variations of your original image instead of cropping it into different aspect ratios and losing important details.

**Optimal input range**

***Input Image Area:*** Ensure that the ratio of the input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.

***Canvas Size:*** The canvas size should be up to an area of 5000x5000 pixels.
Here are some examples:

**original image (Generated by Bria)**: 

<img src="https://bria-image-repository.s3.amazonaws.com/images/caeaa19524d69ad6.jpg" width="200"/>

**results**:

<img src="https://bria-image-repository.s3.amazonaws.com/images/d4d49719b5a54e49.jpg" width="400"/> <img src="https://bria-image-repository.s3.amazonaws.com/images/cbf61f2b859662c0.jpg" width="200"/> <img src="https://bria-image-repository.s3.amazonaws.com/images/aa9b3036e5c6d43a.jpg" width="600"/> 


 **original image (Stock Image)**: 


<img src="https://bria-image-repository.s3.amazonaws.com/images/c64220ebda5ce787.jpg" width="200"/>

**results**:

<img src="https://bria-image-repository.s3.amazonaws.com/images/d35530e95ab7c509.jpg" width="400"/> <img src="https://bria-image-repository.s3.amazonaws.com/images/84752d2fca8a6ae3.jpg" width="200"/> <img src="https://bria-image-repository.s3.amazonaws.com/images/904f62b0dce4fb8c.jpg" width="600"/>

## Headers

- `api_token` string, required

## Request body

- object
  - `image_url` string — The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
  - `file` string — The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
  - `canvas_size` integer[] — The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
  - `original_image_size` integer[] — The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
  - `original_image_location` integer[] — The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
  - `prompt` string — Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
  - `seed` integer — You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
  - `negative_prompt` string — This parameter is optional. Bria currently supports prompts in English only.

## Response `200`

Successful operation.

- object
  - `code` integer
  - `description` string
  - `message` string — A message that describes the request status. The options are Finished sucessfully, Content might not be safe for work.
  - `prompt` string — The prompt used to generate the expansion. If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
  - `result_url` string — URL that represents the updated visual created in the request. It is a temporary URL that will expire
  - `seed` integer — If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
  - `status` string — The request status. The options are SUCCESS, NSFW.

## Other responses

- `400` — Bad request. Missing or invalid parameters.
- `401` — Unauthorized. Invalid API key or authentication token.
- `404` — Not found. Image could not be found at the provided URL.
- `413` — Payload too large. Image file size exceeds the 12MB limit.
- `415` — Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
- `429` — Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
- `451` — Unavailable for legal reasons.
- `460` — Failed to download image.
- `500` — Internal server error. An error occurred on the server.

---

[API](https://skmtc.net/bria-ai/apis/the-bria-api.md) · [All operations](https://skmtc.net/bria-ai/apis/the-bria-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bria-ai/the-bria-api/versions/2768230345a5/schema)
