I am trying to make an endpoint that would receive an SVG and output a PNG. However all of my SVGs have the text element in them and whenever this runs it stops and output everything in the image prior to the first text element.
Potentially a bug?
app.post('/keepsakes/:title', function (req, res) {
var gm = require('gm'),
imageMagick = gm.subClass({ imageMagick: true });
var svg = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + req.body.svgCode;
var buf = new Buffer(svg);
res.set('Content-Type', 'image/png');
imageMagick(buf, 'img.svg').stream('png', function (err, stdout, stderr) {
stdout.pipe(res);
});
});
I am trying to make an endpoint that would receive an SVG and output a PNG. However all of my SVGs have the text element in them and whenever this runs it stops and output everything in the image prior to the first text element. Potentially a bug?