Last active
May 16, 2017 13:08
-
-
Save ecoopnet/3e8fb487d1c2738b37519ab363685803 to your computer and use it in GitHub Desktop.
Android の drawable-xxhdpi から drawable-hdpi, drawable-xhdpiに自動で画像作成します。
This file contains 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/sh | |
# Android の drawable-xxhdpi から drawable-hdpi, drawable-xhdpiに自動で画像作成するスクリプトです。 | |
# Android プロジェクト直下で動きます。 | |
# app/src/main/res/drawable-xxhdpi フォルダを検索し、 drawable-xhdpi, drawable-hdpi に変換します。 | |
# また、このスクリプトを動作させるにはImageMagickが必要です。 | |
( | |
resDir=app/src/main/res | |
if [ '!' -d "$resDir" ]; then | |
echo execute this script on a Android project root directory. >&2 | |
exit 1 | |
fi | |
cd "$resDir" | |
mkdir -p drawable-xhdpi | |
mkdir -p drawable-hdpi | |
src=drawable-xxhdpi | |
for i in $(ls "$src" ); do | |
identify "$src/$i" "drawable-hdpi/$i" "drawable-xhdpi/$i" | |
# xxhdpi -> hdpi: 1.5 / 3 = 0.5 | |
#convert "$src/$i" -resize "50%x50%!" "drawable-hdpi/$i" | |
# xxhdpi -> xhdpi: 2 / 3 = 0.666667 | |
#convert "$src/$i" -resize "67%x67%!" "drawable-xhdpi/$i" | |
done | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment