title: How to convert an SVG image using JavaScript into SVG code to get the polygon or path?
body: <p>I'm interested in knowing whether it is possible to select an SVG file, let's say, example.svg in your html file using JavaScript/jQuery and get the polygon/polypath/path as a string for further manipulations <strong>without saving the image to desktop and using InkScape/Adobe Illustrator or any other vector processing program to extract the code manually</strong>.</p>
  
  <p>Here's what I'm aiming for:</p>
  
  <p><em>BEFORE</em></p>
  
  <pre><code>&lt;img src="example.svg" /&gt;
  </code></pre>
  
  <p><em>AFTER</em></p>
  
  <pre><code>&lt;svg xmlns="http://www.w3.org/2000/svg" version="1.1"&gt;
    &lt;polygon points="100,10 40,180 190,....." style="......"/&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>and the code I'm hoping to work with:</p>
  
  <pre><code>$(document).ready(function() {
  
      // convert the svg into polygon, for instance
      function convertSVG(svg){
          ...
      }
  
      convertSVG(/* get that SVG in img tags */);
  
  })
  </code></pre>