-
-
Save jkotchoff/6518054 to your computer and use it in GitHub Desktop.
Updated the gist for @_StockLight. As per @jeffbonnes advice at @ticonf melbourne 2013, this version expects a Resources/images directory (instead of Resources/iphone/images) that contains the standard and @2x images which are served straight to iOS and also MDPI Android devices.
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
type mogrify >/dev/null 2>&1 || { echo >&2 "» This script requires mogrify. Please install ImageMagick first!"; exit 1; } | |
rm -rf Resources/android/images | |
mkdir Resources/android/images | |
mkdir Resources/android/images/res-xhdpi | |
mkdir Resources/android/images/res-mdpi | |
echo " » Copying the splash screen" | |
cp Resources/iphone/Default.png Resources/android/images/res-mdpi/default.png | |
cp Resources/iphone/[email protected] Resources/android/images/res-xhdpi/default.png | |
cd Resources/images | |
echo " » Copying the folder structure so bash won't complain" | |
find ./* -type d -exec mkdir ../../Resources/android/images/res-mdpi/{} \; | |
find ./* -type d -exec mkdir ../../Resources/android/images/res-xhdpi/{} \; | |
echo " » Copy all resources to MDPI, this is" | |
echo " the same density as a non-retina iOS device" | |
find ./* -type f -exec cp {} ../../Resources/android/images/res-mdpi/{} \; | |
cd ../../Resources/android/images/res-mdpi/ | |
echo " » Move the retina resources to XHDPI, which" | |
echo " has the same density as a retina iOS device" | |
find ./* -type f -regex ".*@2x.*" -exec mv {} ../res-xhdpi/{} \; | |
cd ../res-xhdpi | |
echo " » Remove @2x from XHDPI filenames" | |
find ./* -type f -exec bash -c 'file={}; mv $file ${file/@2x/}' \; | |
cd ../ | |
echo " » Generate HDPI by copying XHDPI and resize these by 75%" | |
mkdir res-hdpi | |
cp -R res-xhdpi/* res-hdpi | |
cd res-hdpi | |
find ./* -type f -exec mogrify -resize 75% {} \; | |
cd ../ | |
echo " » Generate res-normal-XHDPI by copying XHDPI" | |
echo " this seems like it's specific to my project" | |
mkdir res-normal-xhdpi | |
cp -R res-xhdpi/* res-normal-xhdpi | |
echo " » Delete MDPI because android will find these in Resources/images" | |
rm -rf res-mdpi | |
echo " » Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment