Apply to my task
arXiv:2610.19025 ★ 84 Oct 13, 2026

Coding Agents as Illustrators: SVG and Canvas Instead of an Image Generator for Diagrams, Design and Text in Images

Key result

The paradox: an agent that can only write code draws diagrams and labels more accurately than an image generator. Its photos, though, are almost always worse. The method lets you make infographics, diagrams and symbols with an exact number of blocks and verbatim text, with no garbled letters. The agent doesn't paint pixels, it writes a program: in SVG markup (or in code for a Canvas) every block has its own coordinates, color and label. The image is assembled from explicit parts instead of being guessed as a whole. In design and symbols the agent beats gpt-image-1 in most comparisons.

01

TL;DR

The study shows that a coding agent (Claude Code, Cursor and the like) can draw not with pixels but with a program: it writes SVG markup or JavaScript for Canvas, renders it and, if it wants, looks at the result. The agent sets the position, size and color of every element explicitly. So anything that has to sit in exactly the right spot (labels, boxes, arrows, object counts) comes out more accurately than with a regular image generator.

The headline finding: the agent's skills are lopsided. In design, diagrams and symbols it beats the older gpt-image-1 generator in most comparisons. Wherever you need a "photographic" look (people, landscapes, lighting, materials), it loses almost every time. Text in the image and clean composition come out great, but hands, perspective and highlights look like they were drawn with a ruler. Two more surprises. Drawing blind, without looking at intermediate images, works almost as well as drawing with feedback. And a 4x refinement budget added next to nothing.

Bottom line: if the task is about structure, hand it to a coding agent. Leave photorealism to a native generator. The agent doesn't need lots of revision rounds; it needs the right "drawing interface" (SVG, Canvas) and a crisp brief. The authors also showed that a written procedure in context (construction order, tone grouping, how to lay down a stroke) gives the agent an artistic style: ink, charcoal, watercolor, oil.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: Identify the task type → structure/text/diagram OR photo/people/lighting
STEP 2a: Structure → coding agent (SVG or Canvas) → file + render
STEP 2b: Photorealism → a regular image generator
STEP 3: Check → a checklist of "what must be in the image" (yes/no per item)
STEP 4: 1–2 revision rounds, no more → final result
(For style: add a written drawing procedure for the chosen technique to the context)

All of this happens in an ordinary agent session. Steps 1–4 run in a single session.

03

Example

Task: An Amazon seller is building listing images for an insulated travel mug. They need a 1200×1200 infographic: the mug in the center, four benefit badges ("Hot for 12 hours", "304 Steel", "16 oz", "Leak-proof"), and arrows from the badges to the mug. Regular generators garble text and mess up the number of badges. This is exactly the zone where code wins.

Prompt:

You are working as a layout designer. Draw an infographic for an Amazon
product listing as a single SVG file, 1200×1200 px.

Content:
- Center: a simplified vector travel mug (body, lid, handle), navy blue
- Background: light gray, #F2F4F7
- Four rounded-corner badges, two to the left and two to the right of the mug:
  1. "Hot for 12 hours"
  2. "304 Steel"
  3. "16 oz"
  4. "Leak-proof"
- A thin arrow from each badge to the matching part of the mug
- Sans-serif font, English text, nothing cut off at the edges

Work like this:
1. First, list the coordinates and sizes of all blocks.
2. Write the SVG.
3. Render it to PNG and open the result.
4. Check it against the checklist, answering "yes/no" for each item:
   - Exactly 4 badges?
   - Does the text on each badge match the spec word for word?
   - Does the text stay inside the badge?
   - Does every arrow point at the mug?
   - Size is 1200×1200?
5. Fix only the items marked "no". No more than two revision rounds.
Save the result as card.svg and card.png.

Result: The agent will first output a table of block coordinates, then the SVG code and a PNG render. Then it walks through the checklist and tells you what it fixed. The mug will be stylized and flat, not photographic. The badge text will be readable and verbatim. The block count will match the spec. For a lifelike photo of the mug with glossy highlights, you need a different tool.

04

Why It Works

The weakness: a regular image generator paints the picture "all at once," and details like the exact number of objects, long text or block placement aren't written down anywhere explicitly. So they drift.

The strength: the model is excellent at writing code. In SVG and Canvas, every element has coordinates, a color and text. That's a structure you can check by eye and item by item. Counts, labels and ordering can be verified right in the markup.

How the method gets around the weakness: the task moves from "paint it in pixels" to "describe it as a program." The agent stops guessing the whole image and assembles it from explicit parts. That's why design, diagrams and symbols come out better, while lighting, materials and anatomy stay weak: describing them in code takes far too many subtle decisions.

Control levers: - Harness (the drawing interface): SVG and Canvas 2D gave the best results. Drawing pixel by pixel or with simple primitives did noticeably worse. - Number of revision rounds: fewer than you'd think. In the study, a 4x budget barely improved the result. - Checklist: the more concrete the items ("exactly 4 badges"), the more precise the fixes. - Written style procedure: add the construction order and a description of the technique to get a medium-specific result.

05

Prompt Template

The paper contains no ready-made prompts: the authors describe protocols rather than publishing prompt texts. The template below is assembled from their findings (code instead of pixels, a checklist, few revision rounds).

You are working as a {executor_role}. Draw {what_to_draw} as a single
{code_format} file, size {size}.

Content:
{list_of_elements_with_exact_text_and_numbers}

Style: {style_colors_fonts}

Work like this:
1. List the blocks with their coordinates and sizes.
2. Write the code.
3. Render the result and open it.
4. Check it against the checklist, answering "yes/no" for each item:
   {checklist_of_3-6_verifiable_items}
5. Fix only the items marked "no". No more than {number_of_rounds} revision rounds.
Save the result as {file_name}.
  • {code_format} — SVG for static diagrams and infographics, HTML Canvas for complex graphics.
  • {checklist} — only items you can answer "yes/no" (counts, verbatim text, boundaries, size).
  • {number_of_rounds} — 1–2. More barely helps.

🚀 Quick start — paste into a chat or an agent:

Here is a "drawing with code plus a checklist" template. Adapt it to my task: {your task}.
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask about the exact text, numbers and sizes, the format (SVG or Canvas) and what counts as an error. It needs this to build the checklist, which is what the whole quality check rests on.

06

Limitations

⚠️ Photorealism: People, landscapes, lighting, materials and perspective are worse with a coding agent than with a regular generator. In the "scenes" and "people" categories it wins only a small fraction of comparisons. For these tasks the method actually hurts.

⚠️ Aesthetics: Structural accuracy is not the same as beauty. The agent produces a clean, flat image. Anatomy and natural forms stay below native-generator quality in every configuration.

⚠️ A strong modern generator: Against gpt-image-2, the agent wins in design and symbols only by a slim margin. Most of the headline gains were measured against the older gpt-image-1.

⚠️ Extra iterations: Quadrupling the refinement gave only a small structural gain and didn't make the image noticeably better overall.

⚠️ Part of the paper is a hypothesis: The idea of agents having an "internal visual language of thought" rests on indirect observations (the same layout and tones across different runs). It yields no practical takeaways.

07

How They Studied It

A team from UCLA and Tsinghua University built the AgentDrawBench benchmark: 200 prompts of seven types, from photos to diagrams, drawn from four published test sets. They then had agents (GPT-6-Astra, Kimi K3, DeepSeek V4.1 Flash) draw them in different ways: pixel by pixel, with shapes, with Canvas 2D, with SVG, through the JS Paint graphics editor and through Blender. Results were compared with the native generators gpt-image-1 and gpt-image-2. They measured three things. Structure was checked with a yes/no checklist for every element of the prompt. Perception was scored on ten criteria such as anatomy, lighting and material. Overall preference was decided by a judge model in pairwise comparisons, with the image order swapped to remove position bias.

The results were sharply lopsided. Structural accuracy for Canvas 2D was 85.8% versus 68.8% for gpt-image-1. In design and symbols the win rate reached 92%. In scenes and people there were almost no wins (13% and 6%). Two things were surprising. Blind drawing scored 83.0% versus 85.6% with image feedback. And a fourfold budget improved the result by just 1.2 pp. The practical takeaway: the bottleneck is the drawing interface, not the number of attempts.

A separate experiment showed that the SVG code an agent converts an image into helps answer questions about that image. Accuracy when answering from the code was 69.0%, from the rendered version 65.0%, from the original 74.0%. In the "academic materials" and "digital world" domains, answers from the code were more accurate than answers from the image itself. The reason is simple: the code explicitly holds the text, coordinates and object counts, so they don't get lost in the background. In a button-counting example, the agent counted four from the code but miscounted three from the photo.

08

Adaptations and Extrapolations

🔧 Technique: "Convert to code first" → precise answers about diagrams and screenshots

The paper shows this on image question answering: code reconstruction helped with documents, diagrams and interfaces. Example:

Before answering, convert this dashboard screenshot into SVG: every block, label and number
must be a separate element with coordinates. Then answer the question
using only the SVG: {question}

This is an extrapolation: on your own data, compare answers from the direct path and the code path. In the paper the effect depends on image type and is weaker for photos, scenes and people.

🔧 Technique: add a written style procedure → get a medium-specific result

In the paper, procedures (construction order, tone grouping, edge control) were extracted from video demonstrations and fed to the agent in context. You can package such a procedure as an instructions file or a skill:

"Watercolor" style: 1) start with transparent washes in broad patches; 2) leave
the light areas of the paper untouched; 3) layer from light to dark;
4) finish by adding accents with a dry brush.

The paper's results here are qualitative, shown on examples. There are no quantitative measurements of the benefit.

09

Resources

  • Paper: How Far Can Coding Agents Go in Visual Generation?
  • Authors: Hengguang Zhou, Yuanhao Ban, Jiaqi Feng, Xiaohuan Pei, Justin Cui, Cho-Jui Hsieh
  • Universities: University of California, Los Angeles; Tsinghua University
  • Datasets and tools mentioned: AgentDrawBench (the authors' benchmark), WorldBench, MMRB2, JS Paint, Blender Cycles, SketchAgent

Research digest

Key result

The paradox: an agent that can only write code draws diagrams and labels more accurately than an image generator. Its photos, though, are almost always worse. The method lets you make infographics, diagrams and symbols with an exact number of blocks and verbatim text, with no garbled letters. The agent doesn't paint pixels, it writes a program: in SVG markup (or in code for a Canvas) every block has its own coordinates, color and label. The image is assembled from explicit parts instead of being guessed as a whole. In design and symbols the agent beats gpt-image-1 in most comparisons.

Principle

It all comes down to the task type. Need structure, text, a diagram — give it to a coding agent. Need people, lighting, a landscape — give it to a regular generator. After that the process is simple: list the block coordinates, write the SVG, render to PNG, check against a yes/no list, fix only the "no" items. First a plan in coordinates, then code, then an item-by-item check. Think of a layout designer with a ruler versus a painter working by eye. The ruler beats the eye wherever precision matters. For natural lighting the ruler is useless. One more trick: a written procedure in context sets the style. Describe the construction order and the brushwork techniques, and you get ink, charcoal, watercolor or oil.

Why it works

A regular generator paints the image all at once. The number of objects and long text aren't written down anywhere, so they drift. In code everything is explicit: how many badges, what they say, where they sit. You can check it item by item, right in the markup. The task turns from "guess the pixels" into "describe it as a program," and the model is strong at code. The flip side: lighting, materials and anatomy can't be described in code — too many subtle decisions. In scenes and people the agent wins only a small fraction of comparisons. The kicker: drawing blind, without looking at intermediate images, is almost as good as drawing with feedback. And a 4x revision budget added almost nothing. So it's not about the number of rounds but about the right interface (SVG, Canvas) and a crisp brief. Against the newer gpt-image-2 the edge in design is small. Most of the gains came against the older gpt-image-1. Also: the paper's idea of an agent's "internal visual language of thought" remains a hypothesis with no practical takeaways.

When to apply

Design and infographics → product listing images, diagrams, icons, posters with text, especially when you need an exact block count and verbatim text. For ink, charcoal or watercolor styling, add a written procedure for the technique. NOT suited for photorealism: people, landscapes, lighting, glass and metal come out worse than with a regular generator. Beauty isn't guaranteed either: you get a clean flat image, not a masterpiece.

Mini recipe

1. Decide whose task it is: structure and text go to the coding agent; photos and lighting stay with a regular generator. 2. Set the role and format: layout designer, one SVG file, an exact size such as 1200×1200. 3. Spell out the content verbatim: all labels, numbers, colors, a sans-serif font. 4. Ask for a plan: have the agent first list the blocks with coordinates and sizes, and only then write code. 5. Have it render and open the result: save a PNG and look at it. 6. Write a 3-6 item checklist: only yes/no questions like "exactly 4 badges?" and "does the text match verbatim?". 7. Cap the revisions: fix only the "no" items, no more than 1-2 rounds. More barely helps. 8. Want a style: add a description of the construction order and the technique's methods to the context. 9. Don't want to write from scratch: ask the model to adapt the template `Here is a "drawing with code plus a checklist" template. Adapt it to my task: {your task}. Ask me questions to fill in the fields.` It will ask about text, numbers, sizes and what counts as an error.

Examples

[BAD]: `Draw an infographic for an Amazon travel mug listing: four benefits` [GOOD]: `You are working as a layout designer. Draw an infographic for an Amazon product listing as a single SVG file, 1200×1200 px. Center: a flat navy-blue travel mug. Background #F2F4F7. Four rounded-corner badges, two on the left and two on the right: "Hot for 12 hours", "304 Steel", "16 oz", "Leak-proof". A thin arrow from each badge to the mug. Work like this: 1. List the coordinates and sizes of all blocks. 2. Write the SVG. 3. Render to PNG and open it. 4. Check, answering "yes/no": exactly 4 badges? Text verbatim? Text stays inside the badge? Every arrow points at the mug? Size 1200×1200? 5. Fix only the "no" items, no more than two rounds. Save as card.svg and card.png.` Result: the badge text is readable and verbatim, and there are exactly four blocks. The mug will be flat and stylized. For a photo with glossy highlights you need a different tool.

In plain words

Regular image models produce visuals as a hallucination made of pixels — they just guess the whole picture at once, so they keep fumbling the details. Coding agents work in a fundamentally different way: they don't try to paint right away, they write executable code. Instead of fuzzy probabilities, the agent sets exact coordinates, margins and literal text strings in a program, which rules out random smudges.

It's the difference between hiring a tipsy painter and an engineer with a blueprint. The painter hands you a gorgeous vibe, but draws six fingers, mixes up the arrows and, instead of readable text, gives you Elvish gibberish. The coding agent is the pedantic nerd with a ruler who does all the math first and makes the browser render exactly what you asked for.

What actually carries the day: vector SVG markup for crisp lines, the Canvas API for complex blocks, and a visual feedback loop where the agent looks at its own render. If a seller needs an infographic for a travel mug with exactly four badges of benefits, the agent won't draw three or five. It writes clean, correctly spelled text with no melted letters, lines up the arrows to the pixel and doesn't break the layout.

The example here is product listings, but the principle leaves ordinary diffusion models in the dust on plenty of other tasks. It's a perfect fit for technical diagrams, product banners, interactive reports and UI mockups — anywhere you need mathematical rigor rather than artistic haze. Keep image models for fantasy desktop wallpapers; real business content needs structure.

Long story short: stop torturing image generators with dozens of prompts trying to get legible text. For data-heavy graphics, code beats diffusion. Whoever moves banner production to Claude Code or Cursor first will save a ton of stress and design budget. Everyone else will keep regenerating the same image twenty times and fuming over why the AI made a typo again.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Coding Agents as Illustrators: SVG and Canvas Instead of an Image Generator for Diagrams, Design and Text in Images arXiv:2610.19025

Sign in to apply this study New accounts get 50 free credits.