mcpField
I
image-to-diagram

image-to-diagram

github.com/mindmorassDocuments237 installsUpdated 37w ago
Repository

About image-to-diagram

image-to-diagram is a skill for turning visual diagrams into editable Mermaid or DOT code. It helps developers document and version diagrams as text, with optional ingestion into Qdrant for reuse.

Key features

  1. 01Image analysis for nodes and relationships
  2. 02Mermaid diagram generation
  3. 03DOT/Graphviz output
  4. 04Color and style mapping
  5. 05Optional Qdrant ingestion

Use cases

  1. 01Convert architecture screenshots into code
  2. 02Turn whiteboard flows into diagrams
  3. 03Version-control diagrams with source code
  4. 04Reuse diagram patterns through Qdrant

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mindmorass/reflex --skill image-to-diagram

After installing, type/image-to-diagramin Claude Code to confirm it loaded.

Details

From the project README

Image to Diagram Conversion

Convert visual diagrams into editable, version-controllable code.

Workflow

Image → Claude Vision → Mermaid/DOT code → Save → Optionally ingest to Qdrant

Supported Input

TypeQuality
Screenshots of diagramsExcellent
Architecture tool exportsExcellent
Clean whiteboard photosGood
Hand-drawn diagramsModerate (clear boxes/arrows help)
Low-contrast/blurry imagesPoor

Output Formats

Mermaid (default)
  • Flowcharts, sequence diagrams, class diagrams, ER diagrams
  • Renders in GitHub, GitLab, Notion, VS Code
  • File extension: .mmd or .mermaid
DOT/Graphviz
  • More layout control
  • Better for complex graphs
  • File extension: .dot or .gv

Conversion Process

1. Analyze the Image

Read the image and identify:

  • Overall structure (hierarchy, flow, network)
  • Components/nodes and their labels
  • Relationships/connections between components
  • Groupings/subgraphs
  • Color coding (convert to styles)
2. Choose Diagram Type
Visual PatternMermaid Type
Boxes with arrows (flow)flowchart TD/LR
Sequence of interactionssequenceDiagram
Classes with relationshipsclassDiagram
Database tableserDiagram
States and transitionsstateDiagram-v2
Timeline/phasesgantt or timeline
Hierarchical groupsflowchart with subgraph
3. Generate Code

Flowchart template:

%% Description of the diagram
%% Source: converted from image

flowchart TD
    subgraph GroupName["Group Label"]
        A[Component A]
        B[Component B]
    end

    A --> B
    B --> C[External]

    %% Styling
    style A fill:#color,stroke:#border,color:#text

Sequence diagram template:

sequenceDiagram
    participant A as Service A
    participant B as Service B

    A->>B: Request
    B-->>A: Response
4. Apply Styling

Map visual colors to Mermaid styles:

%% Color mapping
style NodeName fill:#hexcolor,stroke:#bordercolor,color:#textcolor

%% Common colors
%% Blue: fill:#2563eb,stroke:#3b82f6,color:#fff
%% Green: fill:#059669,stroke:#10b981,color:#fff
%% Red: fill:#dc2626,stroke:#ef4444,color:#fff
%% Orange: fill:#d97706,stroke:#f59e0b,color:#fff
%% Purple: fill:#7c3aed,stroke:#8b5cf6,color:#fff
5. Save and Optionally Ingest
# Save to file
# Write to ~/Desktop/diagram-name.mmd

# Ingest to Qdrant for pattern reuse
/reflex:ingest ~/Desktop/diagram-name.mmd --collection personal_memories

Tips for Best Results

  1. Describe intent: "Convert this to Mermaid, it shows a microservices architecture"
  2. Specify format: "Use flowchart with subgraphs" or "Make it a sequence diagram"
  3. Request styling: "Match the colors from the image" or "Use default styling"
  4. Iterate: "Add more detail to the auth flow" or "Simplify the database section"

Example Prompts

"Convert this whiteboard photo to Mermaid"

"Turn this architecture diagram into a flowchart with subgraphs"

"Create a sequence diagram from this interaction flow screenshot"

"Convert to Mermaid, save as microservices-arch.mmd, and ingest to Qdrant"

After Conversion

The diagram can be:

  • Committed to version control
  • Rendered in documentation (GitHub, GitLab, Notion)
  • Ingested to Qdrant for semantic search and pattern reuse
  • Edited and refined as text
  • Used as a template for similar architectures

Comments

Markdown supported