svg/svgo

Option to resize SVGs to custom dimesnions

xandemon opened this issue · 2 comments

SVGO is a great tool for optimizing SVGs. However, there are times when I need to resize or scale them to certain dimensions and I hate the fact that I have to manually use external tools to resize them and then pass resized SVGs to SVGO. It would be so much better to have this feature in SVGO.

My scenario was that I downloaded svgs online but they were too big at around 2000px width and height and I wouldn't want that because even while previewing those SVGs, they go beyond the viewport.

So could this feature be implemented as plugins in SVGO or something? I can work on this feature if approved.

SVGs have width/height and viewbox. You can easily resize a SVG by changing the width and height while leaving the viewbox the same. (However if the preexisting viewbox is incorrect, that's something different)

SVGs have width/height and viewbox. You can easily resize a SVG by changing the width and height while leaving the viewbox the same. (However if the preexisting viewbox is incorrect, that's something different)

Yeah exactly. Most of the SVGs downloaded online have incorrect viewport and thus are unscalable. When optimized with SVGO, the scaling works but by default, it takes the initial width and height and we need to manually resize the SVG with 3rd party tool. Would be great to have that resize feature built-in.