Images - JPEG

Transparent JPG (With SVG)

This is really excellent: take a JPG, which has great compression for photos, but doesn’t support transparency, and link it within an <svg> which can apply a clipping mask based on a path. The path can be traced manually over the photo in Photoshop or Illustrator, and can be exported as an SVG file from Illustrator. The following code (minus the path data), demonstrates how to do this:

Code language: HTML

<svg viewBox="0 0 921.17 1409.71">
    <clipPath id="chris-clip">
      <path d=" ... " />
  <image xlink:href="/images/chris.jpg" clip-path="url(#chris-clip)" x="0" y="0" width="921" height="1409">