Try it interactively and for free in our FLUX Outpainting demo.
Example output
Drag the slider to compare the input image padded onto the target canvas (left) with the outpainted result (right). No prompt was used — the model extended the scene on its own.Endpoint
Submit an outpainting job:Quick start
The API uses an asynchronous workflow:Submit an outpainting request
POST your input image (base64) and the target canvas dimensions to the endpoint. The model extends the existing scene naturally — no prompt is needed.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input_image | base64 string | Yes | Reference image to expand |
width | integer | Yes | Target canvas width in pixels (>=64). width × height must not exceed 4 MP |
height | integer | Yes | Target canvas height in pixels (>=64). width × height must not exceed 4 MP |
reference_offset_x | integer | No | Left offset (px) of the reference image’s top-left corner on the canvas. Negative values allowed. None = center horizontally |
reference_offset_y | integer | No | Top offset (px) of the reference image’s top-left corner on the canvas. Negative values allowed. None = center vertically |
auto_crop | boolean | No | If true, crop the reference image to the canvas bounds when it extends beyond the edges. Defaults to false (out-of-bounds placements return 422) |
mode | string | No | Quality/speed trade-off: high (default) or fast. See Choosing a mode |
output_format | string | No | png (default) or jpeg |
Maximum canvas size: 4 MP. The target canvas area (
width × height) cannot exceed 4 megapixels (4,194,304 pixels). You’re free to choose any aspect ratio within that budget — for example 2048 × 2048, 2730 × 1536 (16:9), or 1024 × 4096 — as long as the two dimensions multiplied together stay at or below 4 MP. Requests above this limit return 422.Image placement
reference_offset_x and reference_offset_y set the top-left corner of the reference image on the output canvas. Drag the reference below to see how the offsets relate to the canvas:
You have two options for placing the reference image on the output canvas:
- Centered (default) — provide the image, set
widthandheight, and leavereference_offset_x/reference_offset_yasNone. The image is centered automatically. - Custom position — set
reference_offset_xandreference_offset_yto control exactly where the top-left corner of the reference image lands on the canvas. Negative values are allowed; if any part of the reference falls outside the canvas, either setauto_crop: trueor the request will return422.
Choosing a mode
Themode parameter trades quality for speed. Both modes accept the same request fields (input_image, width, height, reference_offset_x / reference_offset_y, auto_crop, prompt) and produce the same response format.
| Mode | Speed | Best for |
|---|---|---|
high (default) | Slower | The highest-fidelity results — recommended whenever fine detail, prompt adherence, or consistency with complex content in the source image matters. |
fast | Significantly faster | Naturally extending most scenes — landscapes, backgrounds, textures, and products. May produce lower fidelity in the extended region than high. Typically lower cost as well. |
mode, the request runs in high mode.
Fast mode requirements. Fast mode encodes the reference and pads it in latent space, so a few extra constraints apply on top of the shared ones. Requests that violate them return
422:input_imagemust be a base64-encoded image — image URLs are not supported infastmode.- The placed reference must be at least 64 px per side and have an aspect ratio of at most 8:1.
- The canvas (
width × height) plus internal alignment padding must stay at or below 4 MP. A canvas right at the 4 MP limit may be rejected because of the added padding — reduce it slightly if so.
reference_offset_x / reference_offset_y, width, and height are otherwise accepted; you don’t need to pre-align them.Response format
Initial response
Polling response (success)
status is "Ready", use result.sample.
Tips for best results
- The model extends the existing scene naturally. The endpoint is tuned to continue the input image’s content, lighting, and composition on its own.
- The model was trained on green, blue, and magenta fill colors and performs best with those internally — no caller action needed; the server handles fill colors automatically.
- Keep total output dimensions reasonable. The canvas area (
width × height) is capped at 4 MP, and very large canvases or extreme aspect ratios may reduce quality even within that limit.
Troubleshooting
403 Forbidden— your API key is missing or your project doesn’t have access to this endpoint.422/ validation errors — check base64 encoding and thatwidth/heightare present, at least64, and that their product (width × height) does not exceed 4 MP. The endpoint rejects unknown fields: usereference_offset_x/reference_offset_y(not the olderbbox_x1/bbox_y1).422infastmode specifically — fast mode adds extra geometry constraints (see Choosing a mode): pass a base64 image (not a URL), keep the placed reference ≥ 64 px per side and within an 8:1 aspect ratio, and leave headroom below 4 MP so internal alignment padding still fits. Switch tomode: "high"if your placement can’t satisfy these.- Visible seams — give the model more canvas room around the reference image.

