If you've ever tried to get an AI to generate a clean SVG icon for your project, you know the pain. The images look great in raster formats but turn into messy artifacts when you ask for vectors. One developer found a workaround that's surprisingly elegant: skip SVGs entirely during generation and convert PNGs instead.

Why AI Struggles With SVGs

AIs are getting scary good at generating photorealistic images, yet SVG output remains consistently disappointing. The author notes that tools like Fable claim to handle this well, but verification is difficult. The core issue seems to be that vector graphics require a different kind of precision than raster generation—the AI tends to produce chunky, hand-drawn-looking paths instead of the clean vector marks developers actually want.

The Two-Step Solution

The key insight is simple: don't ask AI for SVGs at all. Instead, generate PNGs that *look* like they could be vectors, then convert them afterward. This approach also gives you a huge advantage—you can fix those tiny consistency issues and artifacts manually before committing to the final format.

Codex Beats Claude Code

When testing different AI coding assistants for this task, Codex significantly outperformed Claude Code. The author describes it as "miles ahead" for this specific use case. More importantly, you need to explicitly forbid the AI from attempting SVG creation in its initial output—treating SVGs as forbidden territory forces it down the right path.

Use a Two-Agent System

The setup involves splitting the work between two specialized agents. The judge/optimizer agent evaluates image quality and consistency while refining prompts, then hands off to an executor subagent for actual image creation. This loop-based approach mirrors what developers do manually when iterating on AI outputs, but with Codex it works out of the box without needing custom commands like /goal or /loop.

The Prompt That Worked

"The end goal is to generate some images for me. This will be a family of svgs that I want to have a similar style and motif, so you should do in two phases... Each svg will be represented in a consistent shared circular segment ring." This single-shot prompt was enough to generate an entire library of animal-and-instrument combinations—a pelican playing violin, an otter with guitar, and more.

Pick the Right Vectorizer

"There are a lot of tools to convert a PNG to SVG. But there is only one that works: vectorizer.ai." The author ran comparisons across multiple platforms and the difference was "abysmal" in favor of this option. The tool's creator apparently holds a Stanford PhD focused on exactly this problem, which explains why it handles complex conversions so much better than free alternatives.

Key Takeaways

  • Generate raster images that mimic vector style rather than requesting SVGs directly from AI
  • Use Codex for coding tasks—it handles this workflow better than competitors
  • Explicitly prohibit SVG generation in your prompts to force the PNG-first approach
  • Implement a judge/optimizer + executor agent structure for consistent results
  • Test multiple vectorizers; quality differences between tools are massive

The Bottom Line

This workaround feels almost too clever, but it works because it plays to AI's strengths rather than fighting its weaknesses. If you've been cursing at SVG outputs from your favorite AI tool, give this two-step method a shot—you might just end up with the clean icons your project deserves.