Converts SVGs to PNGs
Inspired by https://github.com/filamentgroup/svg-to-png
npm install svgtopng
var svgToPng = require('svg-to-png');
svgToPng('path to an .svg', 'path for the output .png'[, options], callback);
var svgToPng = require('../'),
path = require('path');
svgToPng(
path.join(__dirname, './node.svg'),
path.join(__dirname, './results/node500.png'),
{
width: 500,
height: 500
},
function(error){
// if no error, the .png will be on disk
}
);
options are optional.
Resize the image to specified height
Resize the image to specified width
If the svg does not specify a width, this will be used
If the svg does not specify a height, this will be used