Android Icon Converter

Content

App-specific Setup

Of course you do not want to type the commands to the terminal each time you changed something on your icon. Therefore you can find some suggestions here on how to organize your SVG-source files in a way so that you can write a simple .sh file to convert all your icons with one terminal command.

Usually, you have different types of icons for your app. For each type, you can create a folder, e.g. actions, or contextual. Normally, all SVG-files in these folders have to be converted with the same settings.

Simply write a script, which converts all icons with the right settings. After that you can execute this script whenever you changed your icons.

Example

Below you can find an example file convert_icons.sh which runs on Linux. For Windows, different settings and syntax may be needed. You can download the files as well as the script below. The underlying folder structure is as follows:

  • svg/
    • actions/
      • action1.svg
      • action2.svg
      • ...
    • contextual/
      • context1.svg
      • context2.svg
      • ...
  • res/
  • convert_icons.sh

The following example will create icons for two different versions: one set for all versions < v11 (Honeycomb) and one for version ≥ v11. Also, it will create the icons ic_context1_disabled and ic_context1_enabled. All SVG-icons have the color ffffffcc (holo dark, enabled).

#!/bin/bash

# converter executable.
# On Windows it can be neccessary to write /path/to/exe
converter="icon-converter"

# actions: version v11 and above
$converter -i svg/actions -o res -p ic_menu_ -v v11

# menues: v1-v10, therefore no version suffix needed.
# files should be 48x48px in mdpi, therefore scale by 1.5
# files have to be of color 0x33333399 (gray) instead of ffffffcc
$converter -i svg/actions -o res -p ic_menu_ -m ffffffcc 33333399 -z 1.5

# contextual
$converter -i svg/contextual -o res -p ic_ -k on

# actions/action1 enabled / disabled versions >= v11
# enabled: same colors as for normal action
$converter -i svg/actions/action1.svg -o res -p ic_ -s _enabled -v v11

# disabled: color ffffff4c
$converter -i svg/actions/action1.svg -o res -p ic_ -s _disabled \
-m ffffffcc ffffff4c -v v11

# actions/action1 enabled / disabled versions < v11
# enabled
$converter -i svg/actions/action1.svg -o res -p ic_ -s _enabled \
-m ffffffcc 33333399 -z 1.5

# disabled
$converter -i svg/actions/action1.svg -o res -p ic_ -s _disabled \
-m ffffffcc 3333334c -z 1.5

Having a working script and a clean setup, you can now type

$ sh convert_icons.sh

to generate all icons from your SVG-files.


Next: Usage Details

Donate!

Click here to support the developer.