ij.export.image
Image export functionality for diagrams.
Supports exporting diagrams to SVG and PNG formats.
- class ij.export.image.ImageExporter(format: Literal['svg', 'png', 'pdf'] = 'svg', engine: Literal['mermaid-cli', 'playwright', 'graphviz'] = 'mermaid-cli')[source]
Export diagrams to image formats.
- check_dependencies() dict[source]
Check which rendering engines are available.
- Returns:
Dictionary of engine availability
Example
>>> exporter = ImageExporter() >>> available = exporter.check_dependencies() >>> if available['graphviz']: ... print("Graphviz is installed")
- render(diagram: DiagramIR, output_path: str, width: int | None = None, height: int | None = None, background: str = 'white', theme: str = 'default') bool[source]
Render diagram to image file.
- Parameters:
diagram – DiagramIR to render
output_path – Output file path
width – Image width in pixels (optional)
height – Image height in pixels (optional)
background – Background color
theme – Diagram theme (‘default’, ‘dark’, ‘forest’, ‘neutral’)
- Returns:
True if successful, False otherwise
Example
>>> exporter = ImageExporter(format='png', engine='mermaid-cli') >>> success = exporter.render(diagram, 'output.png', width=800)
- ij.export.image.quick_export(diagram: DiagramIR, output_path: str, format: str = 'svg', engine: str | None = None) bool[source]
Quick export diagram to image.
- Parameters:
diagram – DiagramIR to export
output_path – Output file path
format – Image format (‘svg’, ‘png’, ‘pdf’)
engine – Rendering engine (auto-detected if None)
- Returns:
True if successful
Example
>>> from ij import DiagramIR, Node, Edge >>> diagram = DiagramIR() >>> # ... build diagram ... >>> quick_export(diagram, 'diagram.png', format='png')