Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@appwapp-jr appwapp-jr commented Feb 22, 2016

Worked like a charm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.