Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function halfPNGs(){
- dir=$1
- n=0
- while read f
- do
- # Image name
- i=$(basename "$f")
- echo $i
- if [[ $i == *\@2x\.png ]]; then
- # Height of image
- h=$(sips -g pixelHeight $f)
- # Cut off all but the numbers
- h=${h#*: }
- # Width of image
- w=$(sips -g pixelWidth $f)
- # Cut off all but the numbers
- w=${w#*: }
- # Resize the png and output in the same folder with @2x cut off
- sips -s format png -z $(expr $h / 2) $(expr $w / 2) $f --out ${f%@*}\.png
- fi
- done < <(find $dir -iname '*@2x.png') # Find all pngs in directory
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement