Last active
August 29, 2015 14:13
-
-
Save yatatsu/0cab4fd88d9e178ba0ce to your computer and use it in GitHub Desktop.
dpi resource from xxxhdpi
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
# require ImageMagick | |
# usage: find . -type f -name '*.png' | xargs android_res_gen.sh | |
# mkdir | |
[ ! -d xxxhdpi ] && mkdir xxxhdpi | |
[ ! -d xxhdpi ] && mkdir xxhdpi | |
[ ! -d xhdpi ] && mkdir xhdpi | |
[ ! -d hdpi ] && mkdir hdpi | |
[ ! -d mdpi ] && mkdir mdpi | |
for path in $* | |
do | |
echo 'convert... ' $path | |
file="${path##*/}" | |
dir="${path%%/${file}}" | |
if test dir = ./xxxhdpi || | |
test dir = ./xxhdpi || | |
test dir = ./xhdpi || | |
test dir = ./hdpi || | |
test dir = ./mdpi; then | |
echo 'skip... ' $path | |
continue | |
fi | |
# ImageMagick | |
cp $path xxxhdpi/$file #xxxhdpi | |
convert $path -resize '75%' ./xxhdpi/$file ##xxhdpi | |
convert $path -resize '50%' ./xhdpi/$file #xhdpi | |
convert $path -resize '37.5%' ./hdpi/$file #hdpi | |
convert $path -resize '25%' ./mdpi/$file #mdpi | |
echo 'done... ' $path | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment