JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q65654F
  • License MIT

Convert SVG image into PNG.

Package Exports

  • svgpng

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (svgpng) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

svgpng

Build Status Code Climate Code Coverage npm Version

Convert SVG image into PNG.

Installation

Installing PhantomJS

Download PhantomJS and set path to it.

If you are using osX, brew install phantomjs would do this.

Installing svgpng via npm

npm install svgpng --save

Usage

Converting a Single SVG File into PNG

#!/usr/bin/env/node

var svgpng = require('svgpng');

svgpng(
    'src/foo.svg',
    'dest/foo.png',
    {
        size:{
            width:400,
            height:300
        }
    },
    function(err){
        /*...*/
    }
);

Converting Multiple SVG Files into PNG

#!/usr/bin/env/node

var svgpng = require('svgpng');

svgpng.byConf([
    {
        src: 'src/foo.svg',
        dest: 'dest/foo.png',
        size: {
            width: 400,
            height: 300
        }
    },
    {
        src: 'src/bar.svg',
        dest: 'dest/bar.png',
        size: {
            width: 100,
            height: 200
        }
    }
], function (err) {
    /*...*/
});

License

This software is released under the MIT License.