Created
June 16, 2014 13:48
-
-
Save neonichu/24a617d40c12539b2052 to your computer and use it in GitHub Desktop.
Create 1x versions of all images in the CWD.
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
#!/bin/sh | |
# | |
# Create 1x versions of all images in the CWD. | |
# | |
IFS=$'\n' | |
for file in `ls *@2x*` | |
do | |
new_file=`echo $file|sed 's/@2x//g'` | |
size=`identify "$file" 2>/dev/null|cut -d ' ' -f3` | |
width=`echo $size|cut -dx -f-1` | |
new_width=`expr $width / 2` | |
height=`echo $size|cut -dx -f2-` | |
new_height=`expr $height / 2` | |
convert "$file" -resize ${new_width}x$new_height "$new_file" 2>/dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shell programming, how does it even work?