Skip to content

Instantly share code, notes, and snippets.

@kampfgnu
Created May 15, 2016 09:22
Show Gist options
  • Save kampfgnu/db8ccbb7c1263aff257af7b50e0b9d4e to your computer and use it in GitHub Desktop.
Save kampfgnu/db8ccbb7c1263aff257af7b50e0b9d4e to your computer and use it in GitHub Desktop.
batch resize @3x iOS image assets to @2x and @1x
#!/bin/bash -e
# batch resize @3x iOS image assets to @2x and @1x
# copy this script to the folder where the @3x images files live and run "./resizer3x.sh" in terminal.
# this will generate [filename]@2x.[extension] and [filename].[extension] images in the same folder
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
then
convert "$f" -resize 66.6% "${f//@3x/@2x}"
convert "$f" -resize 33.3% "${f//@3x/}"
fi
done
echo "Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment