I'm attempting to output an SVG from Illustrator. My artboard is 256x256 pixels. The top left of the artboard is at 0,0.
When I export my svg, the viewbox
attribute is 0.5 792.5 256 256
. Why isn't it 0 0 256 256
?
All layers/paths/etc are within the 256x256 box. Nothing is outside of it.
Also, I just created a fresh 256x256 document and copy/pasted all my layers from the old file to the new one and the viewbox was 0 0 256 256
as expected. So what was it about the original file that was throwing in that offset in the viewbox
?
Update: I just deleted all the layers except for one, and exported. The viewbox is now: 0.5 536.5 256 256
, which still doesn't make sense. Especially since the artboard is empty now.
Here is the AI file if you want to look: https://www.dropbox.com/s/q0u6r46b3j9sefa/sprites-old.ai?dl=0
Answer
there's nothing wrong with the .ai you provided. i looked at it, spotted nothing wrong, I tried different export options, even resizing the artboard and moving it around.
I did some reading and it turns out Adobe did a half job when it included svg support. Adobe does not use svg viewboxes and offers no way to actually define a viewboxes coordinates.
What you experienced usually happens when you drag / resize artboards on a document. A number of people found themselves facing this issues and the only workaround seems to be exactly what you did. File -> New.
Another fix would be importing the svgs in Inkscape and exporting from there. But I think the file new is way faster.
I'm sorry I can't help you more, it's really up to Adobe to fix this.
PS: This question has some good answers.
No comments:
Post a Comment