Painting2Code  ·  Image-to-code benchmark

Can a model paint a painting, or only replay its pixels?

Four frontier agents repaint Bamboo in Snow (Dapeng Zhengkun, 1774). Every frame replays the submitted program's own Canvas calls, paced by visual progress.

Apprentices learn by copying masterpieces stroke by stroke. We ask multimodal coding agents to do the same: rebuild a museum painting as a program, then check whether that program actually understands how the picture is built.

Try the probe Paper soon Code soon Dataset soon BibTeX

200 masterpieces  ·  4 museum collections  ·  17,323 rubric criteria

The problem

Pixel scores can't tell painting from replaying.

Image-to-code benchmarks grade a submission by how closely its rendering resembles the reference. That reward is just as happy with a program that memorises a snapshot, smuggles in the answer, or tangles every element into one unfactorable blob. Such a program does not paint. It replays pixels.

Conventional metric
0.674

CLIP similarity earned by adversarial shortcut submissions that encode no structure of the painting at all.

Under Painting2Code
0.0

Every shortcut is caught by the fail-closed sandbox before any quality score is computed.

How it works

Grade the picture and the program separately.

Each submission is evaluated along two decoupled pillars. Visual quality is judged from the render. Program quality is measured by running the code, not by reading it.

01

Paint it in code

The agent receives a public-domain masterpiece and writes a self-contained JavaScript canvas program that repaints it. The program must render offline and produce the same pixels on every run.

Canvas 2Dofflinedeterministic
02

Judge the picture

Every painting carries its own image-conditioned rubric tree. Fine-grained criteria from an 18-category ontology score basic visual integrity, reconstruction fidelity, and painterly aesthetics such as brushwork, lighting, and composition.

BasicReconstructionAesthetics
03

Edit the program

The executed editability probe applies a concrete source edit to a copy of the program, re-renders it, and measures where the pixels moved. A small, local change means the element was really there in the code.

localizedunreachableglobal bleedruntime collapse
Fail-closed sandbox. Seven invariants are checked before scoring: no network, no access to the reference, no raster or SVG payloads, and byte-identical renders. Any violation scores 0.0.
Try the probe
Same picture, same edit, two different programs.
Source edit
Before
After edit
Pixel difference
Localized change Changed pixels: 0% of the canvas

Illustration of the probe mechanism. Both programs draw an identical scene; the difference mask is computed live from the two renders in your browser.

Results

Looking right is not the same as being built right.

Frontier models evaluated through two agent harnesses, OpenAI Codex and Anthropic Claude Code. Visual dimensions are scored by an independent multimodal judge; editability comes from executed probes and is reported outside the visual score.

ModelHarnessBasicRecon.AestheticEditability4-dim mean
Fidelity vs. editability
ρ = 0.26

Reconstruction fidelity barely predicts executed editability, while the two render-based dimensions move together at ρ = 0.77.

The painterly gap
7.1–16.4 points

Across every configuration, painterly aesthetics trails basic visual integrity. Models draw outlines and fills well, but not impasto, glazing, or wash.

Harness sensitivity
64.9 → 35.0

The same open-weight model loses almost half its 4-dimension mean when moved from the Codex harness to Claude Code.

Three scatter plots: aesthetics vs reconstruction (rho 0.77), editability vs reconstruction (rho 0.26), visual mean vs agent steps (rho 0.23)
Render-based dimensions cohere (left), but editability decouples from reconstruction fidelity (middle), and more agent steps buy little visual quality (right).
Two case studies. Case A: a modular program whose edit stays inside the umbrella. Case B: a high-fidelity but entangled program whose single edit recolors the whole canvas.
Case A edits one umbrella and nothing else. Case B reconstructs its painting more faithfully, yet one parameter change bleeds across the entire canvas.
The benchmark

Two millennia of art, held to one contract.

Object-level records from four open-access museum collections, each with provenance and rights fields. Every artwork is public domain, and every case ships as a self-contained bundle.

200
Masterpieces
17,323
Rubric criteria
18
Leaf categories
4
Museum collections

Visual genre

Medium & support

Artistic tradition

Epoch

Collections: The Cleveland Museum of Art, The Metropolitan Museum of Art, Art Institute of Chicago, Museum of New Zealand Te Papa Tongarewa.

Citation

Cite this work

@article{painting2code2026,
  title   = {Painting2Code: Can a Model Paint a Painting,
             or Only Replay Its Pixels?},
  author  = {Anonymous},
  journal = {Under review},
  year    = {2026}
}