Mykita
Mykita

Reputation: 467

How to convert an image into "data:image/svg+xml;base64"

How can I convert an image into "data:image/svg+xml;base64"?

I have tried this, but it only generates a data:image/png;base64. I would need data:image/svg+xml;base64. Do I need to save it in a specific way in (example) Photoshop?

Upvotes: 2

Views: 9132

Answers (1)

zx485
zx485

Reputation: 29022

data:image/png;base64 is for bitmap data (PNG) and
data:image/svg+xml;base64 is for vector data (SVG).

So you'd need a program to convert bitmap data (pixels) to vector data which is quite complicated.

The other direction (vector to bitmap) is easy.

The difference explained in short:

  • Vector data consists of complex objects (line, circle, ellipse, ...)
  • Bitmap data consists of a sequence of points (point, point, point...)

Upvotes: 5

Related Questions