Skip to content

Instantly share code, notes, and snippets.

@wannyk
Last active August 29, 2015 14:11
Show Gist options
  • Save wannyk/db7211c5115c9657c81e to your computer and use it in GitHub Desktop.
Save wannyk/db7211c5115c9657c81e to your computer and use it in GitHub Desktop.
#!/bin/bash
for f in $(ls *@2x.png)
do
filename=$(basename $f | sed 's/@2x././g')
echo $filename
H=$(sips -g pixelHeight "$f" | grep 'pixelHeight' | cut -d: -f2)
W=$(sips -g pixelWidth "$f" | grep 'pixelWidth' | cut -d: -f2)
H50=$(($H / 2))
W50=$(($W / 2))
sips --resampleHeight "$H50" "$f" >/dev/null
mv "$f" "$filename"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment