<svg width="450" height="250">
<defs>
<pattern id="image" patternUnits="userSpaceOnUse" height="100" width="100">
<image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/103536-934915.png"></image>
</pattern>
</defs>
<circle id='top' cx="50" cy="50" r="49" stroke="black" fill="url(#image)"/>
<defs>
<pattern id="image2" patternUnits="userSpaceOnUse" height="100" width="100">
<image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104201-933650.png"></image>
</pattern>
</defs>
<circle id='top2' cx="175" cy="50" r="49" stroke="black" fill="url(#image2)"/>
<defs>
<pattern id="image3" patternUnits="userSpaceOnUse" height="100" width="100">
<image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104041-1917730.png"></image>
</pattern>
</defs>
<circle id='top3' cx="300" cy="50" r="49" stroke="black" fill="url(#image3)"/>
</svg>
We are very close to the desired output here, which is player images fitted snugly as the background images of SVG circles. We are running into 2 last issues:
seemingly cannot change the
cx
values. For the 2nd and 3rd circles here, if we update thecx
values to 150 (rather than 175) and 250 (rather than 300), then the images are no longer cutoff. But, we want this space between the images (in general we want to be able to position all circles as desired usingcx
andcy
. Changing thex
,y
values on theimage
elements is not helping. How can we avoid this cutoff while keeping the175
,300
values forcx
?we've intentionally removed the
height
element from theimages
, setting width equal to the circle diameter to get this clean result. However, in the 3rd image, the images width is less than its height, leading to an issue ofwhite-space
at the bottom. It seems in this case we should setheight
to100
and leave the width out, but we do not know the image dimensions beforehand. How can we cleanly have all images fit in circles despite not knowing if height > width or vice versa?