Is this possible? The following is what I tried but it completely fills the circle with black.
<svg id='vizMenu' width="700" height="660">
<defs>
<filter id="dropshadow" height="130%">
<feGaussianBlur in="SourceAlpha" stdDeviation="2"/>
<feOffset dx="0.5" dy="0.8" result="offsetblur"/>
<feMerge>
<feMergeNode/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<circle id='top' filter="url(#dropshadow)" cx="180" cy="120" r="80" stroke="#2E2E2E" stroke-width="2" fill="url('images/word-cloud.png')"/>
<circle id='bottom' filter="url(#dropshadow)" cx="500" cy="300" r="80" stroke="#2E2E2E" stroke-width="2" fill="url('images/word-cloud.png')"/>
<circle id='extra' filter="url(#dropshadow)" cx="180" cy="560" r="80" stroke="#2E2E2E" stroke-width="2" fill="#ffffff"/>
</svg>
Well, I couldn't make it work with the accepted answer. This is how I ended up doing it:
If you want to customize the size, use this as a scale reference:
x = yourPreferredSize
(This scale works for squared images)
This is my solution, the differences are that this doesn't use the
patternUnits="userSpaceOnUse"
and that you specify the desired width and height of the image element.Image repetition problem solved with proper explanation (Thanks to AmeliaBR)
TL;DR: The concept of
objectBoundingBox
andpreserveAspectRatio
are used!An image fill for an svg element is achieved through SVG Patterns...
I know this is an old question, but I used a filter to overlay the image. The above solution didn't work for me because of scaling and it seemed like the images was tiled. I used this instead, I hope it will help others as well.