@bpmn-io/svg-to-image
v1.0.1
Published
Utility for generating images from SVG markup
Readme
@bpmn-io/svg-to-image
Converts an SVG to an image with decent quality.
Usage
import { svgToImage } from 'svg-to-image';
const svg = '<svg>...</svg>';
// Generate PNG
const result = await svgToImage(svg, {
imageType: 'png',
outputFormat: 'blob'
});Build and Run
# install dependencies
npm install
# run project, executing all tasks
npm run allHow it works
This package uses canvg to render SVG elements onto a canvas and then exports them as image data URLs or image blobs.
License
MIT
