code: function(svg, mine, callback) {
          svg = (new XMLSerializer()).serializeToString(svg);
          svg = 'data:image/svg+xml;charset=utf-8,' + encodeURI(svg);
          if (mine == 'image/svg+xml') {
              callback(null, svg);
              return;
          }
          var img = new Image();
          var canvas = document.createElement('canvas');
          var ctx = canvas.getContext('2d');
          img.onload = function() {
              canvas.width = img.width;
              canvas.height = img.height;
              ctx.drawImage(img, 0, 0);
              var dataURL = canvas.toDataURL(mine);
              callback(null, dataURL);
          };
          img.src = svg;
      }
docs: Convert SVG Element to jpeg / png data url
  
  @private
  @param {SVGElement} svg SVG Element
  @param {String} mine Mine
  @param {Function} callback