draw_mermaid_png#
- langchain_core.runnables.graph_mermaid.draw_mermaid_png(mermaid_syntax: str, output_file_path: str | None = None, draw_method: MermaidDrawMethod = MermaidDrawMethod.API, background_color: str | None = 'white', padding: int = 10) bytes [source]#
Draws a Mermaid graph as PNG using provided syntax.
- Parameters:
mermaid_syntax (str) β Mermaid graph syntax.
output_file_path (str, optional) β Path to save the PNG image. Defaults to None.
draw_method (MermaidDrawMethod, optional) β Method to draw the graph. Defaults to MermaidDrawMethod.API.
background_color (str, optional) β Background color of the image. Defaults to βwhiteβ.
padding (int, optional) β Padding around the image. Defaults to 10.
- Returns:
PNG image bytes.
- Return type:
bytes
- Raises:
ValueError β If an invalid draw method is provided.