3 ms·
Some reasons why SVGs shouldn't be used all the time in webpages: * Display time - Rendering and displaying images in a browser is incredibly time-critical. A
by twelvechairs 14y ago
Some reasons why SVGs shouldn't be used all the time in webpages:
* Display time - Rendering and displaying images in a browser is incredibly time-critical. A non-trivial SVG is likely to take much longer to render and display than a PNG. My desktop still struggles to show a wikipedia map of the world - I especially don't want my phone to waste time or battery when it doesn't need to.
* SVG's are built for infinite precision. If you are browsing webpages full of small SVGs its likely you'll waste a lot of bandwidth and processing-time on sub-pixel non-displayed cruft.
* Often you actually need pixel-perfection in display, which SVG isn't really built for (hence the S) and you'll just end up drawing 1-pixel wide lines in SVG form.
tldr: Displays are based on pixels. SVGs aren't built for pixels.
- ygra 14y agoSVGs also carry a preferred output size where you do have pixel-perfect control. It is a bit messy, though, as you need to position lines on half-pixels so that a line with width 1 will not fall on two pixels. I tend to prefer paths when working with pixel-perfect data for that reason. Some icons can be smaller than their PNG equivalent (even more so when served compressed) but that mainly depends a bit on how they're authored. Many authors probably just use Inkscape/Illustrator and accept the 20 KiB of cruft that is embedded automatically instead of writing a simple sub-1-KiB SVG by hand.
- kalleboo 14y ago> My desktop still struggles to show a wikipedia map of the world Are you sure? Mine can render and zoom into it instantly - once the data file is cached. The first time you load it it loads in country-by-country since that's how slow it's getting the data (the typical Wikipedia world map SVG is 1.5 MB, although to be fair the PNG version is only 350 KB).
- quinnirill 14y ago> * Often you actually need pixel-perfection in display, which SVG isn't really built for (hence the S) and you'll just end up drawing 1-pixel wide lines in SVG form. Actually you might find it interesting that SVG supports media queries so you can include multiple presentations of an image for different sizes and even make special cases of some sizes and go for pixel perfection for them. The thing that makes your argument(s) stand true is that SVG support is horrendous (even Inkscape doesn't let you leverage many of SVG's powerful features, e.g. media queries, and worse yet, bloats your SVGs with meaningless cruft).