1.0.1 • Published 7 years ago

svg-to-canvas v1.0.1

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

svg-to-canvas

Greenkeeper badge

svg to canvas

Try it out! view on requirebin

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