1.0.1 • Published 7 years ago
svg-to-canvas v1.0.1
svg-to-canvas
svg to canvas
use with browserify
methods
var convert = require('svg-to-canvas');
var svg = document.querySelector('svg');
convert(svg, function thumbnail(canvas) {
var image = new Image();
image.onload = function() {
image.setAttribute('height', image.height*0.3);
image.setAttribute('width', image.width*0.3);
window.document.body.appendChild(image);
};
image.src = canvas.toDataURL();
});
install
With npm do:
npm install svg-to-canvas
license
MIT