Flux Pro - Expand image
This endpoint allows you to expand an image using the AI Flux Pro model. The image will be expanded based on the provided parameters.
Input size
The image you send must be at least 256 pixels on each side and no
larger than 20 megapixels (width * height <= 20,000,000). Neither side
is capped on its own and there is no aspect ratio restriction: a 30000x600
image is accepted, while a 255x70500 one is rejected because one of its
sides is below 256, even though it is only 18 megapixels.
File size is irrelevant — what counts is the decoded pixel count, so a heavily compressed 60 megapixel photo is rejected just the same. An image outside these bounds is rejected with an error naming the rule it broke.
Sending more than 20 megapixels buys you nothing anyway: the output is capped at roughly 1.6 megapixels regardless of how large the input was, so resize before uploading.
Output size
left, right, top and bottom describe the expansion you are asking for,
but this model does not guarantee that exact output size. The requested
canvas is input_width + left + right by input_height + top + bottom, and
two rules are then applied to it:
- Maximum output size of roughly 1.6 megapixels. If the requested canvas is larger, the whole image is scaled down proportionally until it fits. The aspect ratio is preserved, so there is no single maximum width or height: the cap applies to the total pixel count. A 1200x400 image expanded by 400 pixels on each edge asks for a 2000x1200 canvas and comes back as 1632x976.
- Each side is rounded to the nearest multiple of 16. A requested 916x692 comes back as 912x688; a requested 936x712 comes back as 944x720.
Both rules apply on every request, including small ones, so an output that matches your requested pixels exactly is the exception rather than the rule.
Omitting an edge applies its default (512 left, 512 right, 256 top, 256
bottom). Sending 0 leaves that edge unexpanded; sending 0 on all four
edges returns a 400, since there is nothing to expand.
That said, this is the expand endpoint that stays closest to the pixel
values you request: below the 1.6 megapixel cap, the rounding to 16 is the
only deviation. Expanding an 896x672 image by 500 pixels on the top edge
alone asks for 896x1172 and returns 896x1168. The other two expand endpoints
diverge much further:
ideogram always renders at about 1 megapixel and only preserves the aspect
ratio, and seedream-v4-5 scales any canvas below 3.7 megapixels up. If you
need exact output dimensions, resize the result yourself after generation.
Authorizations
Your Magnific API key. Required for authentication. Learn how to obtain an API key
Body
Base64 image to expand
Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.
"https://www.example.com/webhook"
The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.
Pixels to expand on the left. Omit the field to use the default of 512;
send 0 to leave this edge unexpanded. The requested size is not always
the size you get back — see the description of this endpoint.
0 <= x <= 2048Pixels to expand on the right. Omit the field to use the default of 512;
send 0 to leave this edge unexpanded.
0 <= x <= 2048Pixels to expand on the top. Omit the field to use the default of 256;
send 0 to leave this edge unexpanded.
0 <= x <= 2048Pixels to expand on the bottom. Omit the field to use the default of 256;
send 0 to leave this edge unexpanded.
0 <= x <= 2048Response
OK - The task exists and the status is returned