# Document Illustration (document-illustrator)

AI-powered illustration generator that analyzes document structure, plans optimal image insertion points, generates illustrations via VisionClaw's built-in Gemini tool, and inserts them into the original document.

## Image Generation — VisionClaw Integration

**Primary**: Use VisionClaw's built-in `gemini` tool:

```
gemini(prompt="<illustration description>", output_modality="image")
```

This is the preferred method — uses the agent's configured API key, no extra setup.

## Workflow

```
Backup → Plan insertion points → Generate images → Insert into document → Verify & cleanup
```

1. **Backup** — Copy original document to `{filename}.backup.md`
2. **Plan** — Read the full document, identify core topics, determine precise insertion anchors (context text, not line numbers)
3. **Generate** — Generate all illustrations using the `gemini` tool. For speed, launch multiple Agent subagents in parallel (~10-20s total regardless of count)
4. **Insert** — Each image is inserted at its anchor position using Edit tool (end-to-beginning order to avoid offset issues)
5. **Verify** — Confirm all `![...]()` references and image files exist; remove backup on success

## Configuration

| Option | Values | Default |
|--------|--------|---------|
| Image ratio | 16:9 / 3:4 | 16:9 |
| Cover image | Yes/No | No |
| Number of images | 3-10 | Auto (based on doc length) |
| Style | gradient-glass / ticket / vector-illustration | gradient-glass |

## Illustration Styles

| Style | Best For |
|-------|----------|
| `gradient-glass` | Technical docs, product intros |
| `ticket` | Data reports, infographics |
| `vector-illustration` | Tutorials, stories, branding |

## Technical Details

| Item | Value |
|------|-------|
| Image tool | VisionClaw `gemini` (output_modality="image") |
| 16:9 Resolution | Gemini default (~1024px, or higher with quality setting) |
| 3:4 Resolution | Gemini default (~1024px, or higher with quality setting) |

