Resources
SVG vs raster for visual AI: what pixels throw away
A single poster compared as PNG and as SVG, field by field.
The same poster, twice
Take one designed page and save it two ways. As a PNG it becomes a grid of colour samples. As an SVG it stays a document. Both look identical on screen. Only one of them still knows what it is.
Field by field
Everything below survives in the vector file and is lost, or must be guessed, in the bitmap:
- Headline text: characters, font family, weight, size and baseline position, against pixels that need OCR and a font classifier.
- Chart marks: path geometry with explicit coordinates, against a shape whose underlying values cannot be recovered.
- Layout: a group hierarchy with a viewBox, against implicit arrangement that has to be segmented.
- Palette: declared fills and gradients, against per-pixel samples contaminated by antialiasing and compression.
- Resolution: independent, so the same file can be rendered at whatever size an evaluation needs, against one fixed raster.
The cost of recovering what was thrown away
A raster pipeline spends compute rebuilding structure that existed before export: OCR for the words, segmentation for the regions, a classifier for the chart type. Every one of those stages introduces error, and the error compounds into the training signal.
It is also expensive in storage. A designed page is tens of kilobytes as SVG and hundreds of kilobytes to megabytes as a bitmap at a usable resolution.
Where raster still wins
Photography. A vector file cannot represent a photograph without embedding a bitmap, and a file that embeds one is no longer purely structural. That is why SVGZO excludes files carrying embedded bitmaps from delivery: a mixed file gives a model neither clean geometry nor a clean photograph.