SVG → PNG conversion, browser-free. Adopts phoenix_kit_og's approach: an
embedded resvg/tiny-skia backend when available, with graceful fallbacks.
Backend preference (which_backend/0):
:resvg_nif— the:resvgHex package's NIF (mrdotb/resvg_nif), precompiled viarustler_precompiled. Zero system-install burden in the common case. Optional dependency — add{:resvg, "~> 0.5"}to the host app to enable it; without it this module falls back to a CLI.:resvg_cli— aresvgbinary on PATH (cargo install resvg).:rsvg— librsvg2'srsvg-convert(Debian/Ubuntu:librsvg2-bin).:magick— ImageMagick (magick/convert); last-resort, lower quality.:none— nothing reachable;render/2returns{:error, :rasterizer_missing}so the caller can fall back, never crash.
Errors are returned, never raised. No network is used — image inputs in
the SVG must be data: URLs or local file bytes (an embedded resvg won't
fetch remote http(s) hrefs; some CLI backends might, so prefer data:).
Summary
Functions
Whether any rasterizer backend is reachable on this host.
Rasterize SVG iodata/binary to PNG bytes.
The rasterizer backend reachable on this host (preference order above).
Functions
@spec available?() :: boolean()
Whether any rasterizer backend is reachable on this host.
Rasterize SVG iodata/binary to PNG bytes.
opts: :width / :height (output size; defaults to the SVG's intrinsic
dimensions), :timeout (ms for a subprocess backend, default 5000), and
:backend (force a specific backend instead of auto-detecting).
@spec which_backend() :: :resvg_nif | :resvg_cli | :rsvg | :magick | :none
The rasterizer backend reachable on this host (preference order above).