Batch convert SVGs to PNG base64 using headless Chrome
Source:R/chrome.R
batch_svg_to_base64_chrome.RdConverts multiple SVGs to base64-encoded PNG strings using a single Chrome session. Much faster than calling svg_to_png_chrome() repeatedly.
Usage
batch_svg_to_base64_chrome(
svg_list,
dpi = 300,
background = "transparent",
load_wait = 0,
restart_every = 50,
retry_attempts = 3,
timeout = 10,
progress = TRUE
)Arguments
- svg_list
List of SVG strings or file paths.
- dpi
Resolution (default 300).
- background
Background color (default "transparent").
- load_wait
Extra seconds to wait after each page reports ready (default 0). Readiness (fonts loaded, layout painted) is detected automatically; increased automatically on retries.
- restart_every
Restart Chrome session every N conversions (default 50). Helps prevent memory issues and stale connections.
- retry_attempts
Number of retry attempts on failure (default 3).
- timeout
Maximum seconds to wait for page readiness (default 10).
- progress
Show progress bar (default TRUE).