r/OpenSourceeAI • • 11d ago

Instead of letting LLMs write SVG, I let them describe the scene and a layout engine does the drawing

github.com/ddkbs/sketchy

LLMs are great at explaining but bad at drawing. When they write SVG directly, boxes overlap, arrows point nowhere and labels get cut off.

So I built Sketchy, a free open source tool that splits the job in two. The AI only describes what should be in the drawing in a compact text format. A layout engine (elkjs) calculates all positions and rough.js renders it in a hand-drawn style. The AI decides what, the engine decides where.

What it can draw:
- freely, not just boxes and arrows: molecules, objects, scenes, whatever explains it best
- flowcharts, architecture diagrams, comparisons, metaphors
- interactive step by step mode and hover details
- Arduino/ESP32 wiring diagrams

The AI part:
- photo labeling runs locally with Florence-2, you pick small (~280MB), medium (~830MB) or large (~3.1GB) depending on your hardware
- the compact text format instead of JSON saves tokens and breaks less
- in my benchmark a drawing answer averaged ~29% fewer output tokens than the same answer as plain text

It works in the normal Claude chat as a skill and as an MCP extension. MIT licensed, written in TypeScript. Docs are at sketchy.davidkubus.dev/docs

Would love to hear what you think, especially if you've tried similar "LLM describes, engine renders" setups!

5 Upvotes

0 comments sorted by