Environment:7onez Cti expert RSVG Convert
| Knowledge Sources | |
|---|---|
| Domains | OSINT, Visualization |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Linux/macOS environment with librsvg `rsvg-convert` for high-fidelity SVG→PNG/PDF rasterisation of Mermaid diagrams with Pango font selection.
Description
This environment provides the primary rasteriser for Mermaid SVG output. `rsvg-convert` (from librsvg) uses Pango for font selection, which picks a font per glyph — so the type icons in node labels (🌐 💬 📧) and CJK names render correctly. It is the first-choice rasteriser in `render_mermaid.py`'s fallback chain: rsvg-convert → headless Chrome/Edge → cairosvg. cairosvg is kept as the last resort because it uses cairo's basic text API (one font per text run — the first family named), silently dropping every glyph that font lacks. Without any rasteriser, the SVG is still written but the script exits 1 naming what to install.
= Usage
Use this environment for Mermaid SVG→PNG/PDF rasterisation — producing the hi-res PNG, thumbnail PNG, and vector PDF outputs from Pele-laid-out Mermaid diagrams. It is the mandatory prerequisite (alongside Pele) for `Render_Mermaid_Render`.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | WSL2 on Windows |
| Hardware | Any CPU | Minimal |
| Disk | 50MB | librsvg + Pango + fontconfig |
Dependencies
System Packages
- `librsvg` / `rsvg-convert` (install: `brew install librsvg` / `apt install librsvg2-bin`)
- Pango font system (typically included with librsvg)
Python Packages
None — `render_mermaid.py` shells out to the `rsvg-convert` binary.
Credentials
No credentials required.
Quick Install
# Linux
sudo apt install librsvg2-bin
# macOS
brew install librsvg
Code Evidence
Rasteriser fallback chain documented, from `intel_engine/IntelGraph/scripts/render_mermaid.py:27-32`:
"""RASTERISERS (PNG + PDF), in order of text fidelity: rsvg-convert (librsvg — Pango picks a font
per glyph, so the type icons in node labels (🌐 💬 📧) and CJK names render), then a headless
Chrome / Chromium / Edge (same fallback, slower), then cairosvg. cairosvg uses cairo's basic text
API: one font per text run — the FIRST family named — so every glyph that font lacks is silently
dropped; it is kept as the last resort and warns when the figure carries such glyphs. With none of
them the SVG is still written and the script exits 1 naming what to install.
IntelGraph requirements, from `intel_engine/IntelGraph/requirements.txt:6-10`:
# Mermaid (flows, kill-chains, quick relationship graphs) renders with Pele — NOT a pip package
# and no browser: one pinned module (references/pele.json) fetched into vendor/pele/ by
# scripts/pele_fetch.py, run by Node.js 20+ or Bun. PNG/PDF come from librsvg `rsvg-convert` (a system
# package, installed by scripts/install.sh), else a headless Chrome/Edge, else cairosvg
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `rsvg-convert not found` | librsvg not installed | `apt install librsvg2-bin` / `brew install librsvg` |
| Missing glyphs in PNG/PDF (fallback to cairosvg) | rsvg-convert not available, cairosvg dropped them | Install rsvg-convert for per-glyph font selection |
| Exit 1 "naming what to install" | No rasteriser available at all | Install rsvg-convert (or a headless Chrome/Edge, or cairosvg) |
Compatibility Notes
- Best text fidelity: rsvg-convert is preferred because Pango picks a font per glyph, correctly rendering emoji type icons and CJK characters that cairosvg silently drops.
- Fallback chain: If rsvg-convert is absent, `render_mermaid.py` falls back to headless Chrome/Edge, then to cairosvg (pip). cairosvg warns when the figure carries glyphs its single-font API cannot render.
- SVG still written: Even with no rasteriser installed, the SVG file is always produced — only the PNG/PDF rasterisation fails.