LearnBoost/node-canvas — pull request #406 by petarov (2014-04-23 19:12:52+00:00)
Title: Added: Image can now load SVG files and buffer data

Hi,

This PR extends `Image` with the ability to load `svg` files. The functionality depends on [librsvg](https://wiki.gnome.org/action/show/Projects/LibRsvg). What I originally wanted to do was to convert dynamically generated `svg` images to `png` files at server side. This patch should now provide the ability to do so:

Here's a short example:

```javascript
function test_svg2png(imgSrc, w, h) {
var data = fs.readFileSync(imgSrc);
var b64data = data.toString('base64');
var src = "data:image/svg+xml;base64," + b64data;
var canvas = new Canvas(w, h)
, ctx = canvas.getContext('2d');

var img = new Image;
img.onload = function(){
ctx.drawImage(img, 0, 0);
var pngData = canvas.toBuffer();
};

img.src = src;
}
```

### Build & Support
Test cases are provided for both `make test` and `make test-server` targets.

Windows is currently not supported mainly because I have no access to a Windows installation to test. But it should run fine, if someone is willing to work further on that.