title: How to convert canvas to SVG with embedded image base64 in fabricjs
body: <p>I have fabricjs canvas with image, which I loaded by <code>fabric.Image.fromURL()</code> method.</p>
  
  <p>I need export it to SVG, but I want to export image as embedded source in base64, not as a link.</p>
  
  <p>How can I do it? Is it any way to load image as a source not as a link?</p>
  
  <p>Example code:</p>
  
  <p><strong>Loading image:</strong></p>
  
  <pre><code>fabric.Image.fromURL('./assets/people.jpg', function (image) {
      image.set({
          left: 10,
          top: 30
      });
      canvas.add(image);
  };
  </code></pre>
  
  <p><strong>Exporting to SVG:</strong></p>
  
  <pre><code>canvas.toSVG();
  </code></pre>
  
  <p><strong>In exported SVG I have:</strong></p>
  
  <pre><code>&lt;image xlink:href="http://localhost:8383/app/assets/people.png" /&gt;
  </code></pre>
  
  <p><strong>But I want it in base64 like:</strong></p>
  
  <pre><code>&lt;image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAe8AAAKuCAYAAACIZZSZAAAAAXNSR0IArs4c6QAAAARnQU1BAACx(...)" /&gt;
  </code></pre>