Created
January 22, 2013 16:14
-
-
Save groupsky/4595920 to your computer and use it in GitHub Desktop.
Convert drawable resources from xhdpi to hdpi, mdpi and ldpi
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
#!/bin/bash | |
# add desired categories | |
CATEGORIES=ldpi,mdpi,hdpi | |
# categories scale in % based on xhdpi | |
CATEGORIES_SCALE=37.5,50,75 | |
IFS=',' read -a densities <<< "$CATEGORIES" | |
IFS=',' read -a scales <<< "$CATEGORIES_SCALE" | |
for index in "${!densities[@]}" | |
do | |
echo processig ${densities[index]} resources... | |
if [ ! -d "res/drawable-${densities[index]}" ] | |
then | |
mkdir res/drawable-${densities[index]} | |
fi | |
for i in `find res/drawable-xhdpi/ -name *.png` | |
do | |
convert $i -resize ${scales[index]}% res/drawable-${densities[index]}/${i##*/} | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment