Android icons creation tool

Are you developing an Android application and have you to convert an image to a set of icons ? Do you want to avoid as much as possible repetitive manual operations ?

Here you can find a tool to convert a single image to the set of icons needed by Android for various device screen resolutions.

Before starting you need to have:

  • a Linux system (or any other unix-like system)
  • a working installation of ImageMagick tools

Once you have your system up and running and the tools installed you can go on.

Create in  /usr/local/bin (or any other path you are using to store your scripts/executables) a file named android_icon.sh and inside it put the following code:

After saving the file you have to make it executable ( chmod +x /usr/local/bin/android_icon.sh ). Now you are ready to convert images into set of icons.

The tool needs 4 parameters to do its job:

  • TYPE (first parameter) : the type of icon to create (see below)
  • ORIGINAL_IMAGE (second parameter) : the path of the image you want to convert
  • RESOURCE_NAME (third parameter) : the name of the resource to create. be aware that the tool overwrite any previous resource with the same name!
  • OUTPUT_DIR (fourth parameter) : existing path in which save the set of icons  (very often this will be the directory app/src/main/res inside your project)

Currently supported icon type are:

  • launcher : icons used in the home screen or in the applications list pages.
  • actionbar: icons used in the navigation toolbar displayed in the upper part of the screen
  • dialog: icons used in modal boxes
  • tab: icons used the tabbed toolbar displayed in the bottom part of the screen
  • contextual: icons used for contextual action voices
  • notification: icons used in notification popup boxes

Leave a comment