Creates an HTML image element from an SVG string by converting it to a base64 data URI.
This is useful for embedding SVG content as an image element rather than inline SVG.
Parameters
SVG: {SVG:string}
The SVG markup as a string
Returns HTMLImageElement
An HTMLImageElement with the SVG encoded as a data URI source
Example
constsvgMarkup = '<svg xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40"/></svg>'; constimg = imageFromSvg({ SVG:svgMarkup }); document.body.appendChild(img); // Creates an img element with src="data:image/svg+xml;base64,..."
Creates an HTML image element from an SVG string by converting it to a base64 data URI. This is useful for embedding SVG content as an image element rather than inline SVG.