Image Outpainting API : Expand Any Photo to a New Aspect Ratio With AI
Give it one image and pick a shape. The AI image extender scales your picture into the middle of the new frame, paints the scene around it and returns a PNG. Try it right here, then call the same model from your product with one key and one balance.
- One image
- 10 aspect ratios or auto
- Fixed price per task
- Same model through the API
Features
Key Image Outpainting API Features
Ten aspect ratios, plus auto
Pick 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 5:4, 9:16, 16:9 or 21:9 for each task, or auto, which chooses whichever of those ten is closest to the shape of your original.
Real outpainting, not a border
Your image is scaled down and placed in the middle of the new frame, and the model paints a full scene around it: more sky, more floor, more room, not a thin strip along the edges.
Landscape to portrait and back
Turn a horizontal photo into a 9:16 story, a vertical shot into a 16:9 banner, or anything into a 1:1 post, without cropping away the subject.
No prompt needed
An Image Outpainting API request is just image_url and aspect_ratio. The model reads the picture and decides what belongs beyond its edges, so there's nothing to describe.
High-resolution PNG
The result is a PNG whose size the model sets for the chosen ratio, for example 2752×1536 at 16:9, plus a JPEG preview of up to 1024 pixels on the long side.
About a minute per image
A task takes about 1 to 1.5 minutes from creation to result, and costs the same fixed price whichever ratio you choose.
Overview
What Is the Image Outpainting API?
- Model ID
outpaint-image- Input
- One image
- Aspect ratio
- 11 options
- Price
- $0.0936 per task
Outpainting is the opposite of cropping. Instead of cutting a picture down to fit a new shape, AI extends it and paints what could lie beyond the original frame. The Image Outpainting API does this over HTTP: you send one image and a target aspect ratio, and get back a new, wider or taller picture with your original inside it.
On NanoAPI it's the model outpaint-image of the product outpaint_image. The original is scaled down and centered in the new frame, and the model paints the surroundings to continue the scene. A 4:3 photo becomes a genuine 16:9 or 21:9 picture, not the same photo with a stretched edge.
Because there's no prompt, the AI image extender fits neatly into automated workflows: every task is one image_url and one aspect_ratio, returns exactly one PNG and costs one fixed price. It runs on the same POST /v1/tasks endpoint, API key and prepaid balance as every NanoAPI model, and a failed task is refunded in full.
Try it in the studio at the top of this page, then call the Image Outpainting API at https://api.nanoapi.ai/v1 from your own app. Both run the same model at the same price, so the results you test here are the results your users get.
Pricing
Image Outpainting API Pricing
One fixed price per task: neither the aspect ratio nor the size of your image changes it, and a failed task is refunded in full.
| Price | |
|---|---|
| Per task | $0.0936 |
cost = the price per task, whatever the file
How it works
How to Use the Image Outpainting API
- 1
Step 1: Get your API key
Sign in to NanoAPI with Google and create a key on the API Keys page of the console. It authenticates every Image Outpainting API request, so keep it on your server.
- 2
Step 2: Top up your balance
Add funds on the Top up page of the console. The balance is prepaid in USD, never expires and is shared by every NanoAPI model, image and video alike.
- 3
Step 3: Create a task
Send POST /v1/tasks with model outpaint-image, image_url (a public http(s) link that downloads directly) and aspect_ratio. aspect_ratio is required on every request; send auto to have the closest ratio picked for you.
- 4
Step 4: Get the image
Receive the finished task once at your webhook_url, or poll GET /v1/tasks/{task_id} every 15 seconds or more. After about a minute the extended PNG is at outputs[].url.
Why NanoAPI
Why Use the Image Outpainting API on NanoAPI
One key, every model
Extend an image, then upscale it or remove its background with the same API key and balance. Every NanoAPI model goes through POST /v1/tasks and returns the same task object.
Fixed price, failures free
Every Image Outpainting API task costs the same. If the image can't be read or the task fails, the reserved amount goes back to your balance.
Webhooks or polling
Pass a webhook_url and receive the finished task once, signed to the Standard Webhooks spec (verifying is optional), or poll one task or a batch of task ids.
Safe retries and spend limits
Send an Idempotency-Key and a resent request returns the task it already created instead of charging twice. Cap each key's hourly, daily or total spending in the console.
A console for every request
See each request with its status, input, cost and result, your daily usage by product and every movement of your balance, and manage keys and the webhook secret.
Try online, then integrate
The studio on this page runs the same model at the same price, so you can extend your own images before writing code. The docs also come as one llms.txt file for AI coding assistants.
Use cases
What You Can Build With the Image Outpainting API
One photo, every format
Turn a single product or campaign shot into 1:1 feed posts, 4:5 portraits, 9:16 stories and 16:9 or 21:9 banners without a reshoot.
Room around tight shots
Give a close-cropped portrait or product photo space to breathe, so a headline, a button or a logo fits next to the subject.
Wallpapers and backgrounds
Extend artwork or scenery into wide desktop wallpapers, presentation backgrounds or video thumbnails at exactly the ratio you need.
Auto-resize in your product
Add a fit-to-any-size feature to a design tool, an ad platform or a CMS: when a user picks a format, your server calls the Image Outpainting API and drops in the extended picture.
FAQ
Image Outpainting API FAQ
Can’t find what you need? Write to us.
01What is the Image Outpainting API?
An HTTP API that extends an image beyond its original borders to a new aspect ratio. On NanoAPI you send POST /v1/tasks with model outpaint-image, an image_url and an aspect_ratio, and get one PNG back by webhook or by polling.
02How much does image outpainting cost?
One fixed price per task, whichever ratio you choose. It's reserved when the task is created and charged when it succeeds; a failed task is refunded in full. The live price is in the table above, on the pricing page and in GET /v1/products.
03Which aspect ratios can I choose?
auto, 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 5:4, 9:16, 16:9 and 21:9. auto picks whichever of the other ten is closest to your original. aspect_ratio is required, so every request must include it.
04Does it just add a border around my image?
No. The original is scaled down and placed in the middle of the new frame, and the model paints the whole area around it. Expect a noticeably bigger scene with your picture at its center, rather than the same picture with a thin extension.
05What size is the result?
A PNG whose dimensions the model sets for the chosen ratio; at 16:9, for example, 2752×1536. Every result also has a JPEG preview of up to 1024 pixels on the long side at preview_url, and all links are public and don't expire.
06Do I need to write a prompt?
No. outpaint-image works from your picture alone and decides what to paint around it. The request takes image_url and aspect_ratio; sending a parameter the model doesn't have, such as prompt, returns 400 invalid_request.
07How long does it take, and what if my image can't be used?
About 1 to 1.5 minutes from creation to result, longer when the service is busy. The image is read when the task runs: if it can't be downloaded or opened, the task fails with invalid_media and the reserved amount is refunded in full.
08Can I try it online before integrating?
Yes. Sign in with Google and use the studio at the top of this page: it runs the same model at the same price as the Image Outpainting API and draws on the same balance, so you can check results and costs before you write any code.
Start Using the Image Outpainting API
Extend a photo in the studio above, then bring the same AI image extender into your product with a single API call.