I am doing a clipping mask through SVG clip path. I am using one SVG element with three clipping masking.
Problem is my svg is getting full window width and height, therefore images are also getting full width and height.
So what I want is to move the image inside the clipping path so that I can show the actual area of the image
Here is the Jsfiddle
link.
I don't want to change the image's aspect ratio.. please let me know if there is any way for this .
Thanks
If you don't want your images to stretch and break their aspect ratio, then don't use
preserveAspectRatio="none"
. You'll probably want to use one of the"xxx slice"
variants. Below I have used different ones for each image in order to have them align to the left, centre and right repectively.Update
One solution would be to change your images so that the area of interest is in the desired part of the image.
Otherwise you need to start working with viewBoxes. However, once a
viewBox
gets involved though, you can no longer stretch the parent SVG to fill the page width and height as per the original example. You'll have to be satisfied with a fixed aspect ratio for the image as a whole.Here's one way to solve your problem: