DreaminginCodeZH / AndroidSVGScripts
posted
Category: Vector & SVG & path-view
Minimum SDK Level: None (1 | 1.0)

Badge

View in Github Github project information
Starred: 49
Forks: 7
Watchers: 3
Open Issues: 0

Snapshot pictures

No snapshot for this library yet.

Description

Bash scripts to automate and extend the process of using SVG as Android image asset.

This project is also used by DreaminginCodeZH/MaterialColdStart.

Dependencies

  • inkscape: For PNG genration
  • gcalccmd (shsvgdpi.sh): For (friendly) mathematical calculation.

svgdpi.sh

Usage: svgdpi.sh SVG_FILE [DIR_PREFIX [DIR_SUFFIX]]

This script can automatically generate PNG asset of different Dips from SVG arranged properly for direct usage in Android application.

For instance:

./svgdpi.sh path/to/your/file.avg

Will output the following files:

drawable-mdpi/file.png
drawable-hdpi/file.png
drawable-xhdpi/file.png
drawable-xxhdpi/file.png
drawable-xxxhdpi/file.png

You can also add prefix and suffix to the drawable directory name with command line arguments. See the script source for more detail.