How can we convert bitmap to SVG programmatically in Android?
SVG Library for android
This library is used to manipulate SVG file.
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With