Kroki icon

Kroki

Convert text-based diagrams to images using Kroki API

Kroki

AI-generated

Overview

This node converts text-based diagram source code into image files using the Kroki API. It supports a wide variety of diagram types such as Mermaid, PlantUML, GraphViz, and many others, allowing users to generate visual diagrams from textual descriptions. The node is useful for automating the creation of diagrams in workflows, such as generating flowcharts, UML diagrams, network diagrams, and more, directly from source code. For example, a user can input Mermaid diagram code and get a PNG image output for documentation or presentations.

Use Case Examples

  1. Convert Mermaid flowchart source code to a PNG image for embedding in reports.
  2. Generate PlantUML sequence diagrams as SVG files for use in technical documentation.
  3. Use a custom Kroki server to convert GraphViz DOT language diagrams to PDF format for high-quality printouts.

Properties

Name Meaning
Diagram Type Specifies the type of diagram to convert, such as Mermaid, PlantUML, GraphViz, etc.
Output Format Specifies the output image format: PNG, SVG, or PDF.
Diagram Source The source code of the diagram to convert, provided as text.
Kroki Server Selects whether to use the public Kroki service or a custom Kroki server for conversion.
Custom Server URL URL of the custom Kroki server to use when the custom server option is selected.
Options.Timeout Request timeout in milliseconds for the conversion request.
Options.Binary Property Name Name of the binary property to store the generated image in the output.

Output

Binary

Contains the generated diagram image in the specified format stored under the user-defined binary property name.

JSON

  • diagramType - The type of diagram converted.
  • outputFormat - The output image format.
  • fileName - The filename of the generated image.
  • mimeType - The MIME type of the generated image.
  • success - Indicates failure if conversion failed.
  • bodyType - The JavaScript type of the response body.
  • bodyConstructor - The constructor name of the response body.
  • bodyLength - Length of the response body in bytes.
  • isBuffer - Boolean indicating if the response body is a Buffer.
  • startsWithPNG - Boolean indicating if the response body starts with PNG file signature (only for PNG output).
  • firstBytes - First bytes of the response body in hex (only for non-PNG outputs).
  • url - The URL used for the conversion request.
  • diagramLength - Length of the input diagram source code.
  • debug - Debug information about the response body and request.
  • error - Error message if the conversion failed.

Dependencies

  • Kroki API service

Troubleshooting

  • Ensure the diagram source code is not empty; the node throws an error if the source is missing.
  • If using a custom Kroki server, verify the URL is correctly formatted and accessible (must start with http:// or https://).
  • Timeout errors can occur if the server is slow or unresponsive; increase the timeout option if needed.
  • Errors related to unexpected response types indicate issues with the Kroki server response; check server status and input validity.

Links

Discussion