You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.
I have a series of svg files with 300x300 viewboxes: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" enable-background="new 0 0 300 300">
But grunt-svg2png creates 400x300 PNGs. Given the scalable nature of SVG I could understand the dimensions changing, but the aspect ratio should be maintained.
Even though this is going on a year old, I will just post this in case anyone else runs into these issues.
Like @samdbeckham was saying, just having viewbox is not going to work.
My pngs were being generated with a width and height of 400x300. I realized this is the default given if the original svg does not have the attributes. I also noticed that as the task was running though each svg, if a height and width was present, it will keep using the last known svg that had a height and width set.
How To Solve
Go through each original svg files and establish a height and width.
Since we are dealing with pngs which have hard dimensions, this just has to be done. If you are using a tool such as grunt-svgstore, this shouldn't really matter as it strips out the height and width by default anyways 😄
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a series of svg files with 300x300 viewboxes:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" enable-background="new 0 0 300 300">
But grunt-svg2png creates 400x300 PNGs. Given the scalable nature of SVG I could understand the dimensions changing, but the aspect ratio should be maintained.
PNG:
Original SVG
The text was updated successfully, but these errors were encountered: