Convert SVG vector to Android multi-density png drawables

There is an online tool I worked on which can convert an svg image to different platforms, including android.

By default it will convert it to Android drawable, so you need to change the Android setting from auto to png and it will create all the densities you need.

Please note that the mdpi resolution will have the same size as the svg. So you may need to change the width/height parameters to enlarge to output. Or your can try the service for free which will let you specify the output resolution of the mdpi version.


Question might be a bit outdated, but I searched Internet and didn't find any good solution. So I wrote a simple bash script which does conversion of SVG as well as raster image formats.

Here it is: https://gist.github.com/tntclaus/18f4fe7e8540f1cb283d2c7d8ad21d69

Usage:

./generateAndroidDrawables.sh <image.file> <dp>

It requires at least ImageMagic, which on OS X can be installed via brew or macports. Unfortunately ImageMagic poorly converts SVG, so I added support of Inkscape. If Inkscape is not installed, script falls back to ImageMagic conversion.