I would like to do something very similar to Fill an SVG path element with a background image , except that the solution proposed there will display an image to fill an entire area of ββthe background. I do not want it. If the image fills neither the entire height nor the entire width, I would just like it to rest within the shape of the path, and let it be. If I try to limit the behavior by changing the height / width attributes, the rendering simply scales the image until it fills at least one of the dimensions.
I assume this behavior makes sense as it uses patterns. I see that what I want is not really a "model". I just want to tickle the image in the middle of my form just as it is, and not make a template out of it. However, I want the shape boundaries defined by my SVG outline to crop the image rendering when the image size goes past those borders. I do not know yet to get this behavior, except for using the template for the fill attribute, as it was done in the answer to this question.
In a similar question: To add a background image (.png) to the SVG circle shape , the user at the very bottom seems to indicate that he used a filter and not a pattern to achieve what I want to achieve. However, when I try to do this, the actual form is not taken into account during rendering. The image is rendered without any relation to the boundaries of the form, which seems almost useless.
Is there any way in SVG to get this background image similar to a picture, but without actually splitting the image into a template?
html image svg background-image
Michael
source share