Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to resize SVGs to custom dimesnions #2005

Open
xandemon opened this issue May 11, 2024 · 2 comments
Open

Option to resize SVGs to custom dimesnions #2005

xandemon opened this issue May 11, 2024 · 2 comments

Comments

@xandemon
Copy link

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.

@KTibow
Copy link
Contributor

KTibow commented May 12, 2024

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)

@xandemon
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@KTibow @xandemon and others