Created
December 25, 2012 17:00
-
-
Save brendanjcaffrey/4374212 to your computer and use it in GitHub Desktop.
A little bash script that takes a bunch of retina sized images, moves them to image@2x.png and then creates a half size version using imagemagick.
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/bash | |
# loops through a directory of files, moves all .png files to file@2x.png | |
# and then resizes it using imagemagick to 50% size in file.png | |
shopt -s nullglob # if there are no .png files in the directory, then the below line won't just return *.png | |
ext=png | |
for file in *.$ext | |
do | |
text="${file##*.}" | |
name="${file%.*}" | |
new=$name@2x.$ext | |
if ["$text"="$ext"] | |
then | |
mv $file $new | |
convert $new -resize 50% $file | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment