Skip to content

Instantly share code, notes, and snippets.

@schmidt9
Last active March 6, 2019 13:25
Show Gist options
  • Save schmidt9/7e4f97400d1514a83293a11ae54c51b7 to your computer and use it in GitHub Desktop.
Save schmidt9/7e4f97400d1514a83293a11ae54c51b7 to your computer and use it in GitHub Desktop.
Rename iOS splash screen files
#!/bin/sh
echo "path: $1"
#check number of args
if [ $# = 0 ]; then
echo "No path to images directory"
exit 1
fi
for filename in "$1"/*.png; do
echo "file: $filename"
pixelWidth=$(sips -g pixelWidth "$filename" | awk '/pixelWidth:/{print $2}')
pixelHeight=$(sips -g pixelHeight "$filename" | awk '/pixelHeight:/{print $2}')
echo "size: $pixelWidth x $pixelHeight"
if [[ $pixelWidth = 640 && $pixelHeight = 960 ]]; then
cp "$filename" "$1/[email protected]"
elif [[ $pixelWidth = 640 && $pixelHeight = 1136 ]]; then
cp "$filename" "$1/[email protected]"
elif [[ $pixelWidth = 828 && $pixelHeight = 1792 ]]; then
cp "$filename" "$1/[email protected]"
elif [[ $pixelWidth = 1125 && $pixelHeight = 2436 ]]; then
cp "$filename" "$1/[email protected]"
elif [[ $pixelWidth = 1242 && $pixelHeight = 2208 ]]; then
cp "$filename" "$1/[email protected]"
elif [[ $pixelWidth = 1242 && $pixelHeight = 2688 ]]; then
cp "$filename" "$1/[email protected]"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment