npm.io
1.0.1 • Published 7 months ago

@bpmn-io/svg-to-image

Licence
MIT
Version
1.0.1
Deps
1
Size
7 kB
Vulns
0
Weekly
0

@bpmn-io/svg-to-image

CI

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 all

How 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

Keywords