I found this question Resizing SVG in HTML but the answer (removing the <svg>
width
and height
attributes and resizing the viewBox
attribute) doesn't correctly rescale my SVG file.
It's a logo file that I purchased from Looka and I'd like to begin using it but I'm stumped as to how to rescale|resize it.
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="3171.4285714285716"
height="2645.5238095238096"
viewBox="0 -25.714285714285715 3171.4285714285716 2645.5238095238096">
<rect fill="#67b231" width="3171.4285714285716" height="2645.5238095238096" />
<g transform="scale(8.571428571428571) translate(10, 10)">
<defs id="SvgjsDefs2369" />
<g transform="matrix(...)"></g>
<g transform="matrix(...)"></g>
<g transform="matrix(...)"></g>
</g>
</svg>
If I remove the <svg>
width
and height
, the viewBox
retains the size.
If I also then reduce the viewBox
, the image retains the same size, I assume (!?) because the child <rect>
contains width
and height
attributes too.
But, if I remove the <rect>
width
and height
attributes, the result is similarly-sized whitespace (and no logo).
- How should I approach arbitrarily rescaling|resizing the image?
- Should I preserve the
width
:height
ratio when I adjust theviewBox
? - Should the
viewBox
have a positive y-position (currently-25.714...
)?