var path = require('path');
var fs = require('fs');
var sizeOf = require('image-size');
var extend = require('extend');
var objToAttrString = require('../utils').objectToAttrString;

var template = [
  '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink" width="{width}" height="{height}">',
    '<image width="{width}" height="{height}" xlink:href="{src}" />',
  '</svg>'
].join('');

/**
 * @param {String} filepath Path to raster image
 * @returns {String} SVG with encoded raster image
 */
module.exports = function (filepath) {
  var imageAttrs = {};
  var src = fs.readFileSync(path.resolve(filepath), 'base64');
  var info = sizeOf(filepath);

  return template
    .replace(/\{width\}/g, info.width)
    .replace(/\{height\}/g, info.height)
    .replace(/\{src\}/g, 'data:image/'+ info.type +';base64,' + src)
};
@@ -284,32 +284,29 @@
 nk%22 
-width=%22%7Bwidth%7D%22 height=%22
+viewBox=%220 0 %7Bwidth%7D 
 %7Bhei
@@ -842,8 +842,9 @@
  src)%0A%7D;
+%0A

Fix raster image sizing