Hacker News new | ask | show | jobs
by berkes 695 days ago
Svg can, and often will, include (embed) raster images.

But even when not: in practice an SVG will have hundreds or thousands of XML elements (nodes) to draw rather simple-looking shapes even.

2 comments

SVG often includes raster images? That's very surprising to me. I can see some use cases here and there, sure, but using a vector format to 'often' include raster images... i dunno.

Thousands of XML elements is the ideal case, compresses extremely well.

An example, many of Inkscape's filters depend on raster samples that need to be embedded. Complex gradients are also rasterised.
SVG can be rasterized into a cache and just blitted or composited as necessary.

No point to waste CPU cycles rasterizing same SVG image repeatedly.

One would assume the browser already renders the svgs once and the caches it. Maybe, who knows, probably depends on the browser.