Skip to content

Instantly share code, notes, and snippets.

@jamesmccann-zz
Created July 7, 2015 03:08
Show Gist options
  • Save jamesmccann-zz/a5c9006760f611e90a88 to your computer and use it in GitHub Desktop.
Save jamesmccann-zz/a5c9006760f611e90a88 to your computer and use it in GitHub Desktop.
iOS asset resize
#!/bin/bash -e
dir=$1
if [[ -d $dir ]]; then
cd $dir
else
echo "ios-ar expects a directory as the first argument"
exit 1
fi
for f in *; do
if [[ $f == *.png ]];
then
echo "...$f"
convert $f -resize 180x180 "${f%%.*}-@3x.${f#*.}"
convert $f -resize 120x120 "${f%%.*}-@2x.${f#*.}"
convert $f -resize 76x76 "${f%%.*}-@1x.${f#*.}"
fi
done
echo "Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment