# draw_mermaid_png

> **Function** in `langchain_core`

📖 [View in docs](https://reference.langchain.com/python/langchain-core/runnables/graph_mermaid/draw_mermaid_png)

Draws a Mermaid graph as PNG using provided syntax.

## Signature

```python
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,
    max_retries: int = 1,
    retry_delay: float = 1.0,
    base_url: str | None = None,
    proxies: dict[str, str] | None = None,
) -> bytes
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `mermaid_syntax` | `str` | Yes | Mermaid graph syntax. |
| `output_file_path` | `str \| None` | No | Path to save the PNG image. (default: `None`) |
| `draw_method` | `MermaidDrawMethod` | No | Method to draw the graph. (default: `MermaidDrawMethod.API`) |
| `background_color` | `str \| None` | No | Background color of the image. (default: `'white'`) |
| `padding` | `int` | No | Padding around the image. (default: `10`) |
| `max_retries` | `int` | No | Maximum number of retries (MermaidDrawMethod.API). (default: `1`) |
| `retry_delay` | `float` | No | Delay between retries (MermaidDrawMethod.API). (default: `1.0`) |
| `base_url` | `str \| None` | No | Base URL for the Mermaid.ink API. (default: `None`) |
| `proxies` | `dict[str, str] \| None` | No | HTTP/HTTPS proxies for requests (e.g. `{"http": "http://127.0.0.1:7890"}`). (default: `None`) |

## Returns

`bytes`

PNG image bytes.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/51e954877efd2d2c3c5bf09364dcfec8794eadb0/libs/core/langchain_core/runnables/graph_mermaid.py#L277)