Code-driven agents generate images via sketching and texturing stages

GenClaw uses LLM-generated SVG, HTML, or Three.js as an intermediate canvas, then refines with image synthesis for photorealism.

PaperIndependentcs.CVarXiv:2605.30248v2
Junyan Ye · Jun He · Zilong Huang · Dongzhi Jiang · Xuan Yang · Rui Chen · +1 more
Research Digest··2 min read
The authors propose GenClaw, an agentic image generation framework that breaks generation into three stages: conceptualization, code-based sketching (e.g., SVG, HTML, Three.js), and final texturing via an image model. This replaces black-box prompt rewriting with explicit, editable code intermediates, enabling precise control and interpretability.

What they did

The authors developed GenClaw, a multi-stage agentic pipeline for image generation. In the first stage, an LLM performs web search and reasoning to build a conceptual knowledge base for the desired image. In the second stage, the LLM generates executable code—using SVG, HTML, or Three.js—to produce a visual sketch that defines layout, geometry, and composition. In the third stage, an image generation model (e.g., a diffusion model) applies textures, materials, and photorealistic details onto the code-rendered sketch. The system allows users to inspect and edit the intermediate code, providing a controllable canvas between language and pixels.

Key findings

  • The staged code-sketch-to-texture workflow produces images with higher structural fidelity than end-to-end text-to-image models, as measured by layout consistency and object placement accuracy.
  • Users can directly modify the intermediate code (e.g., change SVG coordinates or colors) to achieve targeted edits without regenerating from scratch, enabling precise local control.
  • GenClaw outperforms baseline agentic image generation systems in interpretability, as the code canvas allows human inspection of the agent's geometric and compositional decisions at each step.

Why it matters

This work challenges the prevailing black-box prompt-refinement loop by reintroducing a programmatic intermediate representation that mirrors human artistic workflows (sketching before coloring). It opens the door to more controllable, interpretable, and editable image generation systems, where the agent's reasoning is transparent and modifiable via code.

Caveats

The paper does not provide quantitative comparisons on standard image generation benchmarks (e.g., FID, CLIP score) against strong text-to-image baselines. The code-sketching stage relies on the LLM's ability to generate valid, well-formed code, which may fail for complex scenes. The final texturing step assumes a compatible image model that can fill in details without distorting the sketch; robustness to varied code formats is not extensively evaluated.

§

Analysis

GenClaw aligns with a growing trend in agentic AI that uses code as a grounding medium — similar to how CodeAct or Voyager leverage code for action — but applies it to the creative domain. By making the intermediate representation human-editable, it addresses a key limitation of generative AI: lack of precise user control. This work could influence future systems for design, storyboarding, and scientific visualization where geometric accuracy matters.

newspaper

Research Digest

Articles published under the Zotpaper byline are synthesized from multiple source publications by our AI editor and reviewed by our editorial process. Each story combines reporting from credible outlets to give readers a balanced, comprehensive view.