Skip to content

Instantly share code, notes, and snippets.

@jamesmccann-zz
Created October 6, 2014 21:39
Show Gist options
  • Save jamesmccann-zz/bd755073d2a600fd1ac2 to your computer and use it in GitHub Desktop.
Save jamesmccann-zz/bd755073d2a600fd1ac2 to your computer and use it in GitHub Desktop.
Android asset resize script (run inside a folder of 3x images).
#!/bin/bash -e
# Ensure we're running in location of script.
cd "`dirname $0`"
mkdir ./drawable-mdpi
mkdir ./drawable-hdpi
mkdir ./drawable-xhdpi
mkdir ./drawable-xxhdpi
for f in *; do
if [[ $f == *.png ]];
then
echo "...$f"
convert $f -resize 33.3% ./drawable-mdpi/$f
convert $f -resize 50.0% ./drawable-hdpi/$f
convert $f -resize 66.67% ./drawable-xhdpi/$f
convert $f -resize 100.0% ./drawable-xxhdpi/$f
fi
done
echo "Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment