svg-to-canvas

1.0.1 • Public • Published

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

/svg-to-canvas/

    Package Sidebar

    Install

    npm i svg-to-canvas

    Weekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • jameskyburz