Uncodin Logo

Generating Image Assets for Android from SVG Files

By Colin Edwards on Feb 22, 2012
Filed under: Android

Creating image assets for all of the different DPI buckets required for an Android application can be a tedious and time consuming process. Three to four versions of every image are required to cover the various device sizes. Oftentimes a development team simply doesn't have the time or the resources to complete this process. Additionally, prototype or beta applications may not warrant the effort to create all of these individual images.

The need to speed up development inspired the creation of Android-SVG-Asset-Generator. This tool processes SVG images and outputs a correctly sized PNG file for each DPI bucket that Android offers. It can even generate 9-patch images from SVG files with an additional layer in the image. Sites like FileFormat.Info become even more valuable by opening up the vast iconography offered by Unicode and allowing it to quickly be turned into suitable images for an app.

There are cases when this tool isn't the best option. Kirill Grouchnikov makes a great argument against exclusively using vector graphics for UI elements, in his article About those vector icons. The asset generator certainly is not a replacement for a professional graphic designer, but it does fill the need for usable graphics, quickly.

Hopefully others will find this tool quite useful. As usual, feel free to fork the project on GitHub and improve and extend it.