Skip to content

Instantly share code, notes, and snippets.

@benvium
Forked from gingertom/resizer.sh
Last active September 3, 2018 13:30
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save benvium/5419529 to your computer and use it in GitHub Desktop.
Save benvium/5419529 to your computer and use it in GitHub Desktop.
Resize all @3x images in a folder to @2x and @1x sizes. Using this script you need only ever edit the @3x images. Drop this script into the folder containing your images and double-click it in Finder to run. Note it will destructively overwrite the @2x and @1x-sized images, so be careful. Don't run this script in a folder that's not under versio…
#!/bin/bash -e
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
then
echo "$f -> ${f//@3x/@2x}, ${f//@3x/}"
convert "$f" -resize 66.66666% "${f//@3x/@2x}"
convert "$f" -resize 33.33333% "${f//@3x/}"
fi
done
echo "Complete"
@appwapp-jr
Copy link

Worked like a charm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment