Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitmap to SVG Programmatically conversion [closed]

How can we convert bitmap to SVG programmatically in Android?

SVG Library for android

This library is used to manipulate SVG file.

like image 589
Hikmat Khan Avatar asked Sep 13 '26 13:09

Hikmat Khan


2 Answers

You can't convert a raster based image to a vector based image, as the underlying data is completely different, you can read a bit more about the differences on Wikipedia for example:
http://en.wikipedia.org/wiki/Vector_graphics
http://en.wikipedia.org/wiki/Raster_graphics
'Converting' between the two are not a possibility, but there are different algorithms for approximating a conversion. Many programs used for vector drawing (e.g. adobe illustrator or incscape) have options for auto-tracing i.e. fitting vectors to a raster image to get a close result to the original.

In your case, you will either have to come up with your own tracing algorithm, or have a pre-made svg file that you load using the library.

like image 172
Jave Avatar answered Sep 15 '26 01:09

Jave


You can use a raster-to-vector (vectorization) library such as potrace or autotrace, and create an Android native library out of it.

Unfortunately I do not know any such vectorization library entierely made in Java, which would have made the port to Android simpler.

You have to check if the libraries I mentionned above can be easily adapted to native android code (for example, they have to cross-compile to an ARM architecture; you may have dependencies issues too).

like image 35
Laurent Grégoire Avatar answered Sep 15 '26 02:09

Laurent Grégoire



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!