Skip to main content

FLUX 3 Image

Bounding boxes

Tell FLUX 3 where each element goes. Draw a box, describe what belongs in it, and the model composes the image around your layout. Edit the same way: change one box, and everything outside it stays as it was.

What you can do with boxes

Every image below was made or edited with FLUX 3 from a prompt that contains boxes. Hover or tap an edit to compare it with its source.Boxes need no extra parameter. They are written into prompt as a JSON array, next to a description of the image. This tutorial builds that prompt step by step: first for a new image, then for an edit.
Every box is [top, left, bottom, right] in integers from 0 to 1000, measured from the top-left corner. [0, 0, 500, 500] is the top-left quarter of the image, whatever its size or aspect ratio.

Generate a layout

You’ll recreate the image below: a running figure, centered on a flat chartreuse background. It has two elements, so its layout prompt is short.
1

Describe the image and name each element

Write one paragraph about the whole image. Where an element appears, give it an id in angle brackets, such as <silhouette_1>. Use lowercase names with a number, so you can add silhouette_2 later.
Caption
2

Give each element a box and a description

Add one row per id. bbox says where the element sits, and desc says what it looks like. The background fills the frame, and the runner takes the middle 70% of it.
Element table
3

Join them in one prompt and send it

Put the caption first, then a space, then the JSON array. Send the result as prompt, with the aspect ratio you designed the boxes for.
Python
The script saves runner.png and prints its path.
Hover an id in the prompt or a row in the table to find its box. The cursor readout shows grid coordinates, so you can measure positions for your own layouts.
A layout is easiest to write when a language model drafts it. Send it your short idea and the aspect ratio, and ask for the caption and element table. Start from a short prompt has an instruction you can reuse.

Edit an image box by box

To edit, send the image as a reference and describe it with the same kind of element table. Each row now says where an element comes from and where it should end up, so the model knows what to keep, what to move, and what to make new.ref_image_0 is the first image in images; the second is ref_image_1.

Move an element

This edit moves a crocheted knight up the cliff and leaves the rest of the scene alone.
1

List the elements of the source image

Start from the element table of the source. If you generated the image with boxes, reuse that table. Otherwise, ask a vision model to list the main elements with their boxes.
2

Change only the rows you want to edit

Keep every row as a Keep row, with src_bbox and tgt_bbox equal. Then give the knight a new tgt_bbox:
Move row
3

Write the edit as an instruction

Refer to the image as <ref_image_0>, say what changes, and name what stays the same:
Instruction
4

Send the image and the prompt

Pass the source in images, and join the instruction and rows into prompt as before. This uses generate() from the layout example:
Python
aspect_ratio defaults to auto, which keeps the shape of the first reference.
Switch between Before and After, and show the anchors to see every row of this request. Copy request body gives you the complete JSON.

Replace or recolor

To change what an element looks like, make its row a New row and describe the result in desc. Several New rows in one request change several elements at once:
New rows

Remove an element

Set tgt_bbox to null and say in the instruction what to remove. The model fills the area with what was behind the element:
Remove row
Pixels outside the edited boxes usually stay identical. Switch to Changed pixels to see which areas this removal touched:

Format

Write a description using <id> to name each element, then append a JSON array of rows. This all goes in prompt, with no separate box parameter.Every box is [top, left, bottom, right], in integers from 0 to 1000. For example, [0, 0, 500, 500] covers the top-left quarter of the image.

Examples

More layouts and edits from the FLUX 3 launch. Choose an example, inspect its boxes, and copy the request body. Boxes guide placement; they are not clipping masks.

Tips and limits

Boxes guide, they don't clip

An element can extend slightly past its box. Boxes set placement and scale, not a hard mask.

Keep the aspect ratio

The 0–1000 grid stretches with the frame. Send the aspect ratio you designed the boxes for.

Give text its own box

Put each line of text in its own row, and quote the exact words in desc, such as text reading "Sauna".

Don't make boxes too small

In our tests, a new element in a box of about 40 × 25 pixels often did not appear. Give new elements room.

Say it twice for edits

State additions and removals in the instruction as well as in the rows. The instruction and the table should agree.

Anchor what must not move

Add a Keep row for each element that has to stay put. Unlisted areas usually hold, but anchors make it explicit.
To convert pixel coordinates to the grid:
Python

Keep exploring

FLUX 3 Image Editing

The full field reference and more layouts and edits to copy.

Layout prompts

Write captions and element tables that hold, or let a model draft them.

FLUX 3 Text to Image

Complete clients, edits by instruction, and multi-reference requests.

API reference

The full request schema, limits, and response codes.