Created
September 21, 2018 06:25
-
-
Save halivert/32650fcbc9f4b12cfabc94cdb4a32eed to your computer and use it in GitHub Desktop.
Iconos para iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ $# -eq 0 ] | |
then | |
echo "No arguments" | |
exit | |
fi | |
for file in "$@" | |
do | |
fullFileName=$file | |
extension="${fullFileName##*.}" | |
fileName="${fullFileName%.*}" | |
height=$(sips -g pixelHeight $fullFileName | tail -n1 | cut -d" " -f4) | |
width=$(sips -g pixelWidth $fullFileName | tail -n1 | cut -d" " -f4) | |
maxDim=$(( $height > $width ? $height : $width )) | |
r1x="$fileName@1x.$extension" | |
r2x="$fileName@2x.$extension" | |
r3x="$fileName@3x.$extension" | |
tee $r1x $r2x $r3x < $fullFileName > /dev/null | |
sips -Z $(echo "scale=3; $maxDim / 3" | bc -l) $r1x > /dev/null | |
sips -Z $(echo "scale=3; $maxDim * 2 / 3" | bc -l) $r2x > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment