Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding png images into SVG [duplicate]

Tags:

image

svg

Possible Duplicate:
Does SVG support embedding of bitmap images ?

I'm trying to insert PNG images into SVG file. If I use <image> tag I can only set references to PNG images. I wan't to put whole PNG data into SVG, because if PNG file will be moved or deleted, my SVG file should still be rendered with those PNG data.

Is it possible with SVG format?

Thank you in advance!

like image 302
Lukasz Spas Avatar asked Jul 19 '11 13:07

Lukasz Spas


People also ask

Can you embed PNG in SVG?

The SVG <image> element allows to include and render bitmaps within an SVG object. It can display image formats JPEG, PNG and the SVG pictures too.

Can you embed a image in a SVG?

Much like the img element in HTML SVG has an image element to serve the same purpose. You can use it to embed arbitrary raster (and vector) images. The specification requests applications to support at least PNG, JPEG and SVG format files.

Can any PNG be converted to SVG?

You can't just save a PNG into an SVG file like when swapping between JPG and PNG. You will need to convert the raster image into a vector graphic, a process known as vectorization.


1 Answers

There are 2 ways to reference images in SVG you can reference an external source which is "dangerous" because the external resources might become unavailable and the second way is to embed the 64 bit encode of the image directly into the SVG which is what you probably want

There are online tools to convert images to 64 bit encoding When you get these strings you plonk them into the correct tag

I think Inkscape gives an option to load an image in both ways so you won't have to use the online conversion tools.

like image 58
Chasbeen Avatar answered Sep 23 '22 13:09

Chasbeen