On November 28, 2026, Simon Willison published an article titled “Code-driven AI illustrations are more useful than images from image models.” His argument is straightforward: for practical use cases, code-driven AI illustrations are often more useful than images generated by image models.
This is not an argument that SVG will defeat photographic realism, or that code can draw everything. It concerns a different delivery model: AI generates a visual program that can continue to run, rather than a finished raster image.
The approach closely mirrors the engineering practices used to build AI Agents. An Agent does more than produce a one-time response; it calls tools, reads state, modifies files, and runs programs to verify results. Illustration can follow a similar workflow: a model generates components, layout algorithms assemble them, and the SVG remains under version control.
The Debate: Should AI Illustrations Deliver Pixels or Code?
A conventional text-to-image workflow usually delivers a PNG or JPEG file.
That is convenient. A designer places the image in a slide deck or web page. When the copy changes, they ask the model to redraw it. When they need another size, they make another local edit. Each revision can introduce a new random result.
A code-driven illustration delivers something else: SVG, HTML/CSS, a Canvas configuration, or a program responsible for drawing and layout.
The difference is not merely the file format. It is how teams collaborate on the asset after delivery.
| Dimension | Image-model output | Code-driven output |
|---|---|---|
| Deliverable | Bitmap | SVG, components, layout program |
| Editing | Regeneration through prompts | Changes to parameters, code, and components |
| Validation | Visual inspection | Diffs, tests, screenshot comparisons |
| Batch variants | Separate generations | Reuse with substituted data |
| Version control | Binary files | Readable text changes |
Pixel files can certainly live in Git, but Git does not understand that “the moon moved 20 pixels to the left.” Text-based code does. It can also pass through linters, snapshot tests, and automated layout tools.
Simon Willison’s argument is therefore less about aesthetics than engineering: if a visual asset will be produced continuously, whether the deliverable can continue to be manipulated by software is itself part of its quality.
Generating Composable Components
Code-driven illustration does not mean asking an LLM to spit out an entire SVG. A more reliable approach is to divide the illustration into composable components, then involve the model in generating or arranging them.
Consider a product article that needs a process diagram. A layout algorithm can handle the fixed structure: headings, nodes, arrows, and explanatory text. The model can choose node types, write short labels, or suggest a color scheme.
Here is a simplified example:
from dataclasses import dataclass
@dataclass(frozen=True)
class Step:
title: str
description: str
def render_steps(steps: list[Step]) -> str:
width = 760
card_width = 320
card_height = 120
gap = 40
height = 180 + len(steps) * (card_height + gap)
cards = []
for index, step in enumerate(steps):
x = 40 + index * (card_width + gap)
y = 80 + index * (card_height + gap)
cards.append(
f'<rect x="{x}" y="{y}" width="{card_width}" '
f'height="{card_height}" rx="16" fill="#F4F6F8"/>'
f'<text x="{x + 24}" y="{y + 42}" font-size="20">'
f'{index + 1}. {step.title}</text>'
f'<text x="{x + 24}" y="{y + 80}" font-size="14">'
f'{step.description}</text>'
)
return (
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" '
f'height="{height}" viewBox="0 0 {width} {height}">'
'<rect width="100%" height="100%" fill="white"/>'
+ "".join(cards)
+ "</svg>"
)
steps = [
Step("输入需求", "把文案和约束交给 Agent"),
Step("生成组件", "模型输出结构化参数"),
Step("检查结果", "渲染 SVG 并运行快照测试"),
]
print(render_steps(steps))
This code requires Python 3.9 or later and uses only the standard library. It does not attempt sophisticated artwork. It demonstrates one principle: components and data can be separated. When the copy changes, only steps needs to be replaced; when the layout rules change, only the renderer requires an update.
A more mature implementation should also require the model to produce data constrained by a JSON Schema rather than arbitrary SVG. Structured parameters reduce syntax errors and allow component choices, colors, and positions to be validated independently.
Production Needs Repeatable Revisions
For production illustrations, the largest time cost is usually not the initial generation but the maintenance that follows.
Common requirements are highly specific:
- The same illustration must work across a company publication, a website, and presentation slides.
- A/B versions should change only the heading, icon, or data.
- Localized versions need different text lengths.
- When brand colors change, every old asset must be updated consistently.
- Illustrations need to run in CI, where the build can detect overlaps or overflow.
Code-based assets offer practical advantages for these tasks. They can live in Git, where commit history clearly records changes to colors, dimensions, or copy. Code review remains useful as well.
They can also plug into a template system. Templates define the fixed layout, models generate variables, renderers handle dimensions and fonts, and screenshot tests inspect the results. The final output may still be an image, but its creation has become a repeatable software pipeline.
That is far more stable than regenerating a similar image from scratch. At minimum, failures become diagnosable: the model selected the wrong component, the layout algorithm overflowed, or a font failed to load.
Code-driven illustration also introduces engineering costs. Teams must maintain components, design tokens, rendering dependencies, and tests. For a poster that will only be published once, that investment may not be worthwhile.
193 Points and 111 Comments
The article reached the Hacker News front page, earning 193 points and 111 comments. The response shows that developers are genuinely interested in a broader question: beyond generated images, can code become a new delivery layer for visual work?
The debate falls into two broad camps.
One side argues that image models remain clearly stronger in texture, lighting, people, and complex composition. Asking SVG to reproduce a realistic poster often produces something stiff and crude. Sacrificing core visual quality in the name of editability can be counterproductive.
The other side focuses on production systems. Icons, flowcharts, information cards, data visualizations, and templated graphics were already well suited to rule-based generation. For these use cases, structured output is not merely convenient; it is the correct data model.
The disagreement expressed in those 111 comments is not about whether code or pixels are more sophisticated. It is about how much editability a visual task actually requires.
If an asset only needs to be seen once, pixels are enough. If it will be revised ten times, maintained by several people, and adapted to multiple sizes, code gradually becomes more valuable.
The original article and Hacker News discussion are available here:
- Simon Willison: Code-driven AI illustrations are more useful than images from image models
- Hacker News discussion
Workflow Boundaries and an Adoption Checklist
Code-driven AI illustration is better suited to tasks that meet the following conditions:
- The output must be structured rather than an indivisible finished image.
- The artwork follows explicit rules, such as cards, processes, charts, and icon compositions.
- Size, copy, and style variants must be generated frequently.
- The visual asset must fit into version control, review, and automated generation workflows.
- The result can be validated automatically through a browser, SVG renderer, or design tool.
- The team is willing to maintain a component library, Schema, and rendering code.
For tasks dependent on photographic realism, nuanced human expressions, hand-drawn strokes, or highly free-form composition, pixel-based models may still be the better choice. There is no need to rewrite the entire image as code in that case. A hybrid workflow is often more practical: models generate visual material while code handles layout and composition.
Six questions can help teams assess readiness:
- How many times will this illustration need to change after delivery?
- Are multiple sizes or channel-specific versions required?
- Which elements must remain strictly fixed?
- Which elements are suitable for model generation?
- Can the output be validated against a Schema?
- Can rendering errors be detected automatically?
If the team cannot answer the first five questions, it may be wrapping a one-time image generation exercise in a more complex engineering system.
Editorial Perspective
The more significant shift is not that SVG will replace PNG. It is that the unit of delivery in visual workflows may change from an “image” to a “visual program.” In the past, a poster designer delivered a finished asset. For data illustrations or product graphics, teams may instead deliver components, constraints, and rendering rules, with the image emerging as a build artifact. This differs from earlier text-to-image systems, which expanded the supply of visual material. Code-driven workflows expand the ability to revise that material after creation.
AI Agents will likely make this model easier to implement. Models can generate structured components, tools can validate and render them, and Agents can correct layouts based on diffs. The first mature use cases are likely to be relatively constrained: icons, charts, tutorial graphics, and marketing templates rather than complex art.
Questions remain about sophisticated visual expression. The editability of SVG does not guarantee that models can reliably produce convincing people, materials, and compositions. If visual quality does not improve alongside maintainability, this approach may remain limited to engineered illustration rather than professional design. The argument holds when production teams prioritize repeated revision, composability, and validation over the immediate impact of a striking one-off image.
No comments yet — start the discussion