SVG To PNG Render
Workflow
Use the bundled script first:
SCRIPT="$(find "${CODEX_HOME:-$HOME/.codex}" "$HOME/.claude" \
-path "*/skills/svg-to-png-render/scripts/render_svg_png.py" \
-print -quit 2>/dev/null)"
python3 "$SCRIPT" input.svg output.png
If working from the viberesearch repository itself, use
skills/svg-to-png-render/scripts/render_svg_png.py directly.
The script:
- Reads the SVG
width/heightorviewBox. - Starts a localhost-only HTTP server.
- Opens
about:blankwith the Playwright CLI, then runspage.goto(...)andpage.screenshot(...)throughrun-code --filename. - Verifies the output dimensions.
Use this instead of sips or qlmanage for diagrams. On macOS, sips often cannot rasterize SVG, and qlmanage can create cropped or thumbnail-style output.
Requirements
nodeandnpxmust be on PATH.- Playwright can be downloaded through
npx --package playwright. - If browser binaries are missing, use the existing Playwright setup or set
PLAYWRIGHT_BROWSERS_PATHto a writable cache and install browsers.
Notes
- Do not load local SVGs with Playwright CLI
file://; this environment can blockfile:protocol. - The CLI may print
TimeoutErrorafter writing the screenshot because it tries to snapshot the page afterward. Treat the file existence and dimension check as the source of truth. - For repo diagrams, inspect the generated PNG dimensions and use
view_imagefor visual confirmation before committing.
