Layered designs on the Segmind API: send JSON, get every size
Render posts, stories, banners and flyers from one JSON design: real fonts, your logo unchanged, every size checked. One request, $0.30.

If you generate marketing images in code, you have met the problem: the image model draws the headline, gets one letter wrong in one size out of five, and redraws the client's logo. Retrying costs money and still is not exact.
The Video Editor Agent on Segmind now renders layered designs. You send one JSON design (pictures, logo, text, buttons, shapes) with a box for each layer in every size you want. It sets every word in a real font, places the logo file unchanged, renders every size, checks each one, and returns the PNGs with a report. One request renders every size, up to 12, for $0.30.
Contact sheet ig-feed-4x5, 1080x1350 story-9x16, 1080x1920
The request
Send the design as JSON after the words Design render: in the prompt, with response_format set to json so you get every output as a URL. Attach nothing.
# pip install "segmind>=1.1.0"
# export SEGMIND_API_KEY="YOUR_API_KEY"
import segmind
result = segmind.run(
"video-editor-agent",
prompt="Design render:\n{\"schema\":\"segmind.design/1\",\"name\":\"bloom-brunch\",\"brand\":{\"palette\":{\"forest\":\"#1E3B2F\",\"cream\":\"#F7F1E6\",\"clay\":\"#B5532D\"},\"fonts\":{\"display\":{\"family\":\"DM Serif Display\"},\"body\":{\"family\":\"DM Sans\"}}},\"assets\":{\"bg\":{\"src\":\"https://images.segmind.com/public/2ac027b8341674a1b4e243b644c53ac2.jpeg\",\"origin\":{\"type\":\"model\",\"model\":\"nano-banana-2\"}},\"bg_9x16\":{\"src\":\"https://images.segmind.com/public/b67dc5809e567cd116a9876372cd70ce.png\",\"origin\":{\"type\":\"derived\",\"from\":\"bg\",\"op\":\"extend\"}},\"logo\":{\"src\":\"https://images.segmind.com/public/1c79b7b49dab06422b0057c4d0853f7e.png\",\"origin\":{\"type\":\"user\"}}},\"layers\":[{\"id\":\"background\",\"type\":\"image\",\"asset\":\"bg\",\"role\":\"plate\"},{\"id\":\"logo\",\"type\":\"logo\",\"asset\":\"logo\"},{\"id\":\"eyebrow\",\"type\":\"text\",\"text\":\"Weekends, 8 to 11 am\",\"font\":\"body\",\"weight\":700,\"color\":\"clay\",\"transform\":\"uppercase\",\"letter_spacing\":0.14},{\"id\":\"headline\",\"type\":\"text\",\"text\":\"Brunch, but\\nmake it slow.\",\"font\":\"display\",\"weight\":400,\"color\":\"forest\",\"line_height\":1.0},{\"id\":\"offer\",\"type\":\"text\",\"text\":\"20% off every table before 11\",\"font\":\"body\",\"weight\":500,\"color\":\"forest\"},{\"id\":\"cta\",\"type\":\"button\",\"text\":\"Book a table\",\"font\":\"body\",\"weight\":700,\"fill\":\"forest\",\"color\":\"cream\"}],\"formats\":{\"ig-feed-4x5\":{\"preset\":\"ig-feed-4x5\",\"background\":{\"asset\":\"bg\"},\"boxes\":{\"logo\":{\"x\":7,\"y\":6,\"w\":32},\"eyebrow\":{\"x\":7,\"y\":15,\"w\":60,\"h\":3},\"headline\":{\"x\":7,\"y\":19,\"w\":86,\"h\":16},\"offer\":{\"x\":7,\"y\":36,\"w\":70,\"h\":3.5},\"cta\":{\"x\":7,\"y\":41}}},\"story-9x16\":{\"preset\":\"story-9x16\",\"background\":{\"asset\":\"bg_9x16\"},\"boxes\":{\"logo\":{\"x\":8,\"y\":15,\"w\":40},\"eyebrow\":{\"x\":8,\"y\":21,\"w\":70,\"h\":2.4},\"headline\":{\"x\":8,\"y\":24,\"w\":84,\"h\":12},\"offer\":{\"x\":8,\"y\":37,\"w\":84,\"h\":2.8},\"cta\":{\"x\":8,\"y\":41.5}}}}}",
response_format="json",
)
print(result.get("output"))# 1. Submit the request; the reply carries its request_id
REQUEST_ID=$(curl -s -X POST "https://api.segmind.com/v2/video-editor-agent" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Design render:\n{\"schema\":\"segmind.design/1\",\"name\":\"bloom-brunch\",\"brand\":{\"palette\":{\"forest\":\"#1E3B2F\",\"cream\":\"#F7F1E6\",\"clay\":\"#B5532D\"},\"fonts\":{\"display\":{\"family\":\"DM Serif Display\"},\"body\":{\"family\":\"DM Sans\"}}},\"assets\":{\"bg\":{\"src\":\"https://images.segmind.com/public/2ac027b8341674a1b4e243b644c53ac2.jpeg\",\"origin\":{\"type\":\"model\",\"model\":\"nano-banana-2\"}},\"bg_9x16\":{\"src\":\"https://images.segmind.com/public/b67dc5809e567cd116a9876372cd70ce.png\",\"origin\":{\"type\":\"derived\",\"from\":\"bg\",\"op\":\"extend\"}},\"logo\":{\"src\":\"https://images.segmind.com/public/1c79b7b49dab06422b0057c4d0853f7e.png\",\"origin\":{\"type\":\"user\"}}},\"layers\":[{\"id\":\"background\",\"type\":\"image\",\"asset\":\"bg\",\"role\":\"plate\"},{\"id\":\"logo\",\"type\":\"logo\",\"asset\":\"logo\"},{\"id\":\"eyebrow\",\"type\":\"text\",\"text\":\"Weekends, 8 to 11 am\",\"font\":\"body\",\"weight\":700,\"color\":\"clay\",\"transform\":\"uppercase\",\"letter_spacing\":0.14},{\"id\":\"headline\",\"type\":\"text\",\"text\":\"Brunch, but\\nmake it slow.\",\"font\":\"display\",\"weight\":400,\"color\":\"forest\",\"line_height\":1.0},{\"id\":\"offer\",\"type\":\"text\",\"text\":\"20% off every table before 11\",\"font\":\"body\",\"weight\":500,\"color\":\"forest\"},{\"id\":\"cta\",\"type\":\"button\",\"text\":\"Book a table\",\"font\":\"body\",\"weight\":700,\"fill\":\"forest\",\"color\":\"cream\"}],\"formats\":{\"ig-feed-4x5\":{\"preset\":\"ig-feed-4x5\",\"background\":{\"asset\":\"bg\"},\"boxes\":{\"logo\":{\"x\":7,\"y\":6,\"w\":32},\"eyebrow\":{\"x\":7,\"y\":15,\"w\":60,\"h\":3},\"headline\":{\"x\":7,\"y\":19,\"w\":86,\"h\":16},\"offer\":{\"x\":7,\"y\":36,\"w\":70,\"h\":3.5},\"cta\":{\"x\":7,\"y\":41}}},\"story-9x16\":{\"preset\":\"story-9x16\",\"background\":{\"asset\":\"bg_9x16\"},\"boxes\":{\"logo\":{\"x\":8,\"y\":15,\"w\":40},\"eyebrow\":{\"x\":8,\"y\":21,\"w\":70,\"h\":2.4},\"headline\":{\"x\":8,\"y\":24,\"w\":84,\"h\":12},\"offer\":{\"x\":8,\"y\":37,\"w\":84,\"h\":2.8},\"cta\":{\"x\":8,\"y\":41.5}}}}}",
"response_format": "json"
}' | jq -r .request_id)
# 2. Check its status until it is COMPLETED
curl -s "https://api.segmind.com/v2/requests/$REQUEST_ID/status" \
-H "x-api-key: YOUR_API_KEY"
# 3. Fetch the result
curl -s "https://api.segmind.com/v2/requests/$REQUEST_ID" \
-H "x-api-key: YOUR_API_KEY"The response lists, in order: contact_sheet (every size side by side), report (the checks), one PNG per size named for its format, and design_packed, the whole design in one file with its pictures and fonts inside, to keep and send back later.
The design, piece by piece
Here is the same design, readable:
{
"schema": "segmind.design/1",
"name": "bloom-brunch",
"brand": {
"palette": {
"forest": "#1E3B2F",
"cream": "#F7F1E6",
"clay": "#B5532D"
},
"fonts": {
"display": {
"family": "DM Serif Display"
},
"body": {
"family": "DM Sans"
}
}
},
"assets": {
"bg": {
"src": "https://images.segmind.com/public/2ac027b8341674a1b4e243b644c53ac2.jpeg",
"origin": {
"type": "model",
"model": "nano-banana-2"
}
},
"bg_9x16": {
"src": "https://images.segmind.com/public/b67dc5809e567cd116a9876372cd70ce.png",
"origin": {
"type": "derived",
"from": "bg",
"op": "extend"
}
},
"logo": {
"src": "https://images.segmind.com/public/1c79b7b49dab06422b0057c4d0853f7e.png",
"origin": {
"type": "user"
}
}
},
"layers": [
{
"id": "background",
"type": "image",
"asset": "bg",
"role": "plate"
},
{
"id": "logo",
"type": "logo",
"asset": "logo"
},
{
"id": "eyebrow",
"type": "text",
"text": "Weekends, 8 to 11 am",
"font": "body",
"weight": 700,
"color": "clay",
"transform": "uppercase",
"letter_spacing": 0.14
},
{
"id": "headline",
"type": "text",
"text": "Brunch, but\nmake it slow.",
"font": "display",
"weight": 400,
"color": "forest",
"line_height": 1.0
},
{
"id": "offer",
"type": "text",
"text": "20% off every table before 11",
"font": "body",
"weight": 500,
"color": "forest"
},
{
"id": "cta",
"type": "button",
"text": "Book a table",
"font": "body",
"weight": 700,
"fill": "forest",
"color": "cream"
}
],
"formats": {
"ig-feed-4x5": {
"preset": "ig-feed-4x5",
"background": {
"asset": "bg"
},
"boxes": {
"logo": {
"x": 7,
"y": 6,
"w": 32
},
"eyebrow": {
"x": 7,
"y": 15,
"w": 60,
"h": 3
},
"headline": {
"x": 7,
"y": 19,
"w": 86,
"h": 16
},
"offer": {
"x": 7,
"y": 36,
"w": 70,
"h": 3.5
},
"cta": {
"x": 7,
"y": 41
}
}
},
"story-9x16": {
"preset": "story-9x16",
"background": {
"asset": "bg_9x16"
},
"boxes": {
"logo": {
"x": 8,
"y": 15,
"w": 40
},
"eyebrow": {
"x": 8,
"y": 21,
"w": 70,
"h": 2.4
},
"headline": {
"x": 8,
"y": 24,
"w": 84,
"h": 12
},
"offer": {
"x": 8,
"y": 37,
"w": 84,
"h": 2.8
},
"cta": {
"x": 8,
"y": 41.5
}
}
}
}
}
brand names the palette and the fonts. A colour is a name from the palette or a #RRGGBB. A font is any Google Fonts family, spelled as Google writes it ("DM Serif Display", "Noto Sans Devanagari"), fetched with its licence checked. A brand's own font file works too.
assets are the files. Every src must be on Segmind: a generation, an upload or a file in your asset library. Upload a local file first with Segmind's upload API. origin says where a picture came from; mark an extended picture "op": "extend" with "from" its original, and the renderer finds where the original sits inside it, so every point stays where it was.
layers stack bottom to top:
| Type | What it is | Main fields |
|---|---|---|
image | A picture: role is plate (the background), subject (a product or person), decor or lettering | asset, role, shadow, stand_on |
logo | Your logo file, placed as it is | asset, panel (a colour behind it) |
text | Words in a real font | text, font, weight, color, colors, scrim, align, valign, letter_spacing, transform, line_height, max_px |
button | A label on a rounded fill | text, font, fill, color, radius |
shape | A rectangle or ellipse | fill, opacity, radius |
gradient | A linear or radial blend | stops, angle, opacity |
formats are the sizes. Each one names a preset (or its own size), the background picture for that shape, and a box for each layer as x, y, w, h in percent of the frame. A text box is filled with the largest font size that fits, so you place boxes and the renderer sizes the type. A button needs only x and y. A logo box takes w and, optionally, h as a cap. Leave a layer out of one size with "hidden": ["layer-id"].
Presets
| Preset | Pixels | Use |
|---|---|---|
ig-feed-4x5 | 1080x1350 | Instagram and Facebook feed (recommended) |
ig-feed-1x1 | 1080x1080 | Square feed post |
story-9x16 | 1080x1920 | Stories, with the top and bottom 14% kept clear |
reels-9x16 | 1080x1920 | Reels cover, with the bottom 35% kept clear |
link-1.91x1 | 1200x628 | LinkedIn, X and link ads |
yt-thumb-16x9 | 1280x720 | YouTube thumbnail |
slide-16x9 | 1920x1080 | Presentation slide |
leaderboard-728x90 | 1456x180 | Web banner at 2x |
mrec-300x250 | 600x500 | Web banner at 2x |
skyscraper-160x600 | 320x1200 | Web banner at 2x |
a5-portrait, a4-portrait, letter-portrait | 300 dpi | Flyers and leaflets |
poster-18x24 | 2700x3600 | Poster at 150 dpi |
card-85x55, card-us-3.5x2, card-a6 | 300 dpi | Business and greeting cards |
Each preset knows how its placement is seen: a feed post on a phone, a banner at its CSS size, print at its point size. That is what the minimum text size is checked against.
Text that reads on a photo
You don't have to guess a colour. Give a text layer "color": "auto" and a list of colors, and the renderer measures what is actually behind the words in each size and picks the one with the best contrast. Add "scrim": "auto" and, when even the best colour misses WCAG AA, a soft shade is drawn behind those words only. A product in front of the words, a busy patch of background, or text running off the frame are reported by layer.
The report and the three rounds
Every render returns a verdict: PASS, FIX or STOP. Errors block delivery; warnings are things a person might notice. This is the report from the request above:
{
"verdict": "PASS",
"round": 1,
"max_rounds": 3,
"errors": [],
"warnings": [
{"check": "min_size", "format": "ig-feed-4x5", "layer": "eyebrow",
"message": "12.9 px at viewing size (aim for 14 or more: a box about 1.09 times as big each way)."},
{"check": "contrast", "format": "ig-feed-4x5", "layer": "eyebrow",
"message": "Contrast 3.99:1; WCAG AA asks 4.5:1 at this size."},
{"check": "contrast", "format": "story-9x16", "layer": "eyebrow",
"message": "Contrast 3.91:1; WCAG AA asks 4.5:1 at this size."}
]
}
The checks: fonts loaded with every character, copy unchanged, logo uncovered and unstyled, text fitting its box and readable at viewing size, contrast at least 3:1 (AA as a warning), busy backgrounds, products covering words, words overlapping, anything outside the frame or the placement's safe zone, and background extensions that moved the original.
A message tells you what to change. When text does not fit, it says the box size that would fit it. When something sits outside the safe zone, it gives the layer's span and the limits in percent. Fix the design and send it again with the round number after the colon:
Design render: {"round": 2, "design": { ... }}
Round 3 is the last. A design that cannot render at all (a missing box, an unknown font field, a picture that is not on Segmind) is refused within a second, one sentence per problem.
A full pipeline in three calls
- Make the picture. Generate a background with room for the words, for example with Nano Banana 2 at 2K ($0.126). Ask for calm space where the text will go and no text in the picture.
- Fit it to other shapes. For a story from a landscape picture, extend it with Bria Expand Image ($0.04) instead of generating a new one, so both sizes share one scene. To put a product on it, cut it out of your photo with Bria RMBG 3 ($0.018).
- Render the design. One
Design render:request for every size ($0.30).
The design JSON is small enough for an LLM to write. That is exactly how Pixi, Segmind's agent, uses it: it writes the design, reads the report, and fixes it.
Limits
- Up to 12 formats per request and a 4,000-character prompt. A longer design goes as one attached
.jsonfile, withDesign render:alone in the prompt. - Every picture must be a Segmind URL or inside a packed design.
- Type has no outline or drop shadow yet.
Try it without code
This model is unavailable.
- #api
- #design
- #video-editor-agent
- #ads
- #developers


