Skip to content

Instantly share code, notes, and snippets.

@kopiro
Last active August 29, 2015 13:56
Show Gist options
  • Save kopiro/8859612 to your computer and use it in GitHub Desktop.
Save kopiro/8859612 to your computer and use it in GitHub Desktop.
Ti-Resize
#!/bin/bash
# How to install
# curl https://gist.github.com/kopiro/8859612/raw -o /usr/local/bin/ti-resize
# How to use
# Put all your assets @2x in your $TITANIUM_PROJECT/assets
# Open Terminal
# ti-resize (in your Titanium Project directory)
rm -rf app/assets/android/images
rm -rf app/assets/iphone/images
mkdir -p app/assets/android/images
mkdir -p app/assets/android/images/high
mkdir -p app/assets/android/images/medium
mkdir -p app/assets/android/images/low
mkdir -p app/assets/iphone/images
for f in assets/*.*; do
b=$(basename $f)
echo $b
cp $f "app/assets/iphone/images/"${b%%.*}"@2x."${b##*.}
convert $f -resize "50%x50%" "app/assets/iphone/images/"$b
convert $f -resize "75%x75%" "app/assets/android/images/high/"$b
convert $f -resize "50%x50%" "app/assets/android/images/medium/"$b
convert $f -resize "37.5%x37.5%" "app/assets/android/images/low/"$b
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment