Created
January 7, 2019 12:31
-
-
Save xgouchet/fdeaf6d4b819d8c739e33b827100b6c4 to your computer and use it in GitHub Desktop.
Exports an svg image into png images for Android consumption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage export_svg source.svg output.png sizedp | |
function export_svg() { | |
mkdir -p "drawable-ldpi" | |
size=$(($3 * 3 / 4)) | |
inkscape -z -e "drawable-ldpi/$2" -w $size -h $size "$1" | |
mkdir -p "drawable-mdpi" | |
size=$(($3)) | |
inkscape -z -e "drawable-mdpi/$2" -w $size -h $size "$1" | |
mkdir -p "drawable-hdpi" | |
size=$(($3 * 3 / 2)) | |
inkscape -z -e "drawable-hdpi/$2" -w $size -h $size "$1" | |
mkdir -p "drawable-xhdpi" | |
size=$(($3 * 2)) | |
inkscape -z -e "drawable-xhdpi/$2" -w $size -h $size "$1" | |
mkdir -p "drawable-xxhdpi" | |
size=$(($3 * 3)) | |
inkscape -z -e "drawable-xxhdpi/$2" -w $size -h $size "$1" | |
mkdir -p "drawable-xxxhdpi" | |
size=$(($3 * 4)) | |
inkscape -z -e "drawable-xxxhdpi/$2" -w $size -h $size "$1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment