SVG <img> is massive
See original GitHub issuePlease make sure you are testing with the latest release of html2canvas. Old versions are not supported and issues reported for them will be closed.
Please follow the general troubleshooting steps first:
- You are using the latest version
- You are testing using the non-minified version of html2canvas and checked any potential issues reported in the console
Bug reports:
If I use <img src="... .svg">
the svg is super blown up. This appears to only happen with “responsive” svg images (images where no height or width has been set in the actual image encoding). The image and contentBox are rendered with the correct size but the when drawn on the canvas, the image adopts the viewport height.
Here’s the Fiddle: http://jsfiddle.net/1b4mLnfj/2/
Specifications:
- html2canvas version tested with: 1.0.0-rc.1 / 1.0.0-rc.0
- Browser & version: Chrome 73 / Opera 58
- Operating system: OS X
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Why is my SVG file so big? - Graphic Design Stack Exchange
The SVG file is bigger because it contains more data (in the form of paths and nodes) in comparison to the data contained...
Read more >SVG icons are very large when inlining the SVG to the HTML ...
The problem is, however, that the icon is showing up extremely large, like over 1000px width and height, causing scrolling and everything. This ......
Read more >How to optimize and reduce the file size of SVG images
But sometimes complex SVG files can end up with a high file size. In this article, I'm going to break down every possible...
Read more >How to Scale SVG | CSS-Tricks
Until you open up your web page in test browsers and discover that some leave huge blocks of whitespace above and below the...
Read more >Category:Large SVG files - Wikimedia Commons
Category:Large SVG files ... This category is intended to collect files causing problems with the show source option of the W3C validator. SVG...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, i’ll look into it
I was able to solve this by setting the
width
andheight
attributes in the svg. So in the.svg
file source, I changed this:to this
and it worked!