Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- f=$(pwd)
- original_width=$(sips -g pixelWidth $f/drawable-xxxhdpi/$1 | grep "pixelWidth" | tr " " "," | cut -d "," -f4)
- txw=$((original_width/4))
- for i in {1..4}
- do
- case $i in
- 1*)
- dir="drawable-mdpi"
- scale=1
- ;;
- 2*)
- dir="drawable-hdpi"
- scale=1.5
- ;;
- 3*)
- dir="drawable-xhdpi"
- scale=2
- ;;
- 4*)
- dir="drawable-xxhdpi"
- scale=3
- ;;
- esac
- size=$(bc -l <<< "scale=0; $txw*$scale")
- sips --resampleWidth $size "$f/drawable-xxxhdpi/$1" --out "$f/$dir/$1"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement