Layout-to-Image
/v1/images/generationsThe layout-to-image endpoint uses element descriptions and bounding boxes to specify the position, size, and arrangement of text and objects, guiding the model to generate complex compositions of text and images. Request fields, return values, and error codes are the same as on the Text-to-Image page.
Layout JSON structure
The layout JSON is the input for the prompt field. Serialize the complete layout JSON into a string before passing it in; other request parameters are the same as for Text-to-Image.
The overall scene and style.
The type (label), description (caption), and bounding box (bbox) of each element, plus any text to render (text).
Set to "yxyx"; bounding boxes are ordered as [y_min, x_min, y_max, x_max].
Set to "abs_centralized" to use pixel coordinates relative to the canvas center. The origin is the canvas center, with x increasing to the right and y increasing downward. On a 1024×1024 canvas, both axes range from -512 to 512. For a canvas of width W and height H, convert top-left-based coordinates to centered coordinates by subtracting W/2 from x and H/2 from y.
Layout JSON example
{
"summary": {
"meta": ["poster"],
"canvas": "single",
"caption": "A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top."
},
"items": [
{
"label": "text",
"caption": "Large dark-blue uppercase title centered at the top.",
"text": "EXPLORE",
"bbox": [-416, -384, -288, 384]
},
{
"label": "object",
"caption": "A flat blue mountain illustration in the lower center.",
"bbox": [-192, -288, 384, 288]
}
],
"bbox_coord_space": "abs_centralized",
"bbox_format": "yxyx"
}