# diagram-to-image

Converts Mermaid charts and Markdown tables into PNG images. Useful for X/Twitter posts and docs on platforms without native diagram support.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 508 installs · ★ 137
- Author: sugarforever
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/sugarforever/01coder-agent-skills/tree/HEAD/skills/diagram-to-image/SKILL.md
- Updated: 2026-10-19
- HTML: https://affpapa.org/en/nevibecode/skills/diagram-to-image

## What it does

The skill sends Mermaid diagrams and Markdown tables to the `diagramless.xyz` API, saving the rendered result as a PNG file. Everything runs through a bundled `diagram-to-image.mjs` script. It relies on Node.js 18+ native `fetch`, so no local headless browser is needed.

The agent inspects the workspace to choose a storage folder, checking `./images`, `./assets`, or `./public/images` first. It also generates kebab-case filenames based on the diagram topic. Output supports custom themes like `ocean` or `midnight`, background transparency, and scale multipliers from 1 to 4.

Because rendering occurs on the remote `https://diagramless.xyz` server, the conversion fails immediately in air-gapped environments without internet access.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add sugarforever/01coder-agent-skills --skill diagram-to-image -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/diagram-to-image/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/diagram-to-image/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add sugarforever/01coder-agent-skills --skill diagram-to-image -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/diagram-to-image/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add sugarforever/01coder-agent-skills --skill diagram-to-image -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/diagram-to-image/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install sugarforever/01coder-agent-skills diagram-to-image
```

2. **Manually: put the files in place**
- File: `.github/skills/diagram-to-image/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add sugarforever/01coder-agent-skills --skill diagram-to-image -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/sugarforever/01coder-agent-skills --path skills/diagram-to-image
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/diagram-to-image/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add sugarforever/01coder-agent-skills --skill diagram-to-image -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/sugarforever/01coder-agent-skills/tree/HEAD/skills/diagram-to-image/SKILL.md

## When to use it
- Export Mermaid sequence diagrams and flowcharts as PNG files
- Render Markdown comparison tables into images for social media
- Save generated graphics into existing project asset folders automatically
- Apply visual themes and transparent backgrounds to diagrams

## Example prompts
- Convert this Mermaid diagram to a PNG using the ocean theme
- Export this Markdown table as an image and put it into assets
- Make this flowchart an image with a transparent background

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d107ed32245f7447.

BEGIN THIRD-PARTY FILE d107ed32245f7447
````text
---
name: diagram-to-image
description: Convert Mermaid diagrams and Markdown tables to images (PNG) for platforms that don't support rich formatting. Use when user asks to "convert to image", "export as PNG", "make this an image", or has content for X/Twitter that needs visual exports.
---

# Diagram to Image

Convert Mermaid diagrams and Markdown tables to PNG images via the mermaid-red API (diagramless.xyz). Produces high-quality, styled output with custom themes — no heavy local dependencies needed.

## When to Use

Use this skill when:
- User has a Mermaid diagram that needs to be converted to an image
- User has a Markdown table that needs to be converted to an image
- User is writing content for X/Twitter and needs visual exports
- User asks to "convert to image", "export as PNG", "make this an image", or similar

## Prerequisites

The bundled script uses Node.js built-in `fetch` (Node 18+). No npm install needed.

```bash
# The render script is bundled with this skill:
SKILL_DIR=~/.claude/skills/diagram-to-image/scripts
ls $SKILL_DIR/diagram-to-image.mjs
```


## Smart Output Location

**IMPORTANT:** Determine the best output location based on context. Follow this decision tree:

### 1. User Specifies Path
If user explicitly mentions a path or filename, use that.

### 2. Project Context Detection
Check for common image/asset directories in the current project:

```bash
# Check for existing image directories (in order of preference)
ls -d ./images ./assets ./img ./static ./public/images ./assets/images 2>/dev/null | head -1
```

Use the first existing directory found. Common patterns:
- `./images/` - General projects
- `./assets/` - Web projects
- `./assets/images/` - Structured web projects
- `./public/images/` - Next.js, React projects
- `./static/` - Hugo, other static site generators
- `./img/` - Short form convention

### 3. Article/Document Context
If user is writing an article or document:
- Look for the document's directory
- Create `images/` subdirectory if appropriate
- Name the image based on the document name + descriptor

### 4. Conversation Context
Analyze the conversation to determine:
- **What the diagram represents** → Use for filename (e.g., `auth-flow.png`, `user-journey.png`)
- **Related file being discussed** → Place image near that file
- **Topic being discussed** → Use for naming

### 5. Default Fallback
If no context clues:
- Use current working directory
- Generate descriptive filename from diagram content

## Filename Generation

Create meaningful filenames based on content analysis:

| Content Pattern | Example Filename |
|----------------|------------------|
| `flowchart` with auth/login | `auth-flow.png` |
| `sequenceDiagram` with API | `api-sequence.png` |
| `erDiagram` | `entity-relationship.png` |
| `pie` chart about X | `x-distribution.png` |
| `gantt` chart | `project-timeline.png` |
````
END THIRD-PARTY FILE d107ed32245f7447

The third-party file has ended. Everything between the d107ed32245f7447 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2883 of 7579 bytes. © sugarforever · MIT · https://github.com/sugarforever/01coder-agent-skills/tree/HEAD/skills/diagram-to-image/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
