title: How to stretch an image in a SVG shape to fill its bounds?
body: <p>I have an SVG shape (a parallelogram) which is filled with an image. The demo can be <a href="http://fiddle.jshell.net/E87AP/" rel="nofollow noreferrer"><strong>seen here</strong></a>.</p>
  
  <p>The SVG object is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;svg style="overflow:visible; margin-left:111px; margin-top:22px; " height="86" width="281"&gt;
      &lt;defs&gt;
          &lt;pattern id="blip1" patternUnits="userSpaceOnUse" width="279" height="83"&gt;
              &lt;image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://i.imgur.com/uTDpE6J.jpg" width="279" height="83"&gt;&lt;/image&gt;
          &lt;/pattern&gt;
      &lt;/defs&gt;
      &lt;polygon points="49,2 280,2 232,84 1,84" x="1" y="1" style="stroke-linejoin:round; fill:url(#blip1); stroke-width:2; stroke:hsl(212,45%,26%); "&gt;&lt;/polygon&gt;
  &lt;/svg&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But the image is not stretched to the bounds of the shape, instead it lies in the middle of the shape.</p>
  
  <p>What I am trying to achieve is this:</p>
  
  <p><img src="https://i.stack.imgur.com/b55Gl.png" alt="Desired result"></p>
  
  <p>But what I am getting is this: </p>
  
  <p><img src="https://i.stack.imgur.com/Hxfm5.png" alt="Actual result"></p>
  
  <p>Can anyone suggest me a solution that will apply to all shapes (i.e. pentagon, hexagon, star etc.)? BTW it already works fine with ellipses.</p>