Skip to content

Instantly share code, notes, and snippets.

@david90
Forked from benvium/resizer.txt
Last active February 2, 2023 10:08
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save david90/52a38b6279b7beabd7e8 to your computer and use it in GitHub Desktop.
Save david90/52a38b6279b7beabd7e8 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
# Make sure you have installed ImageMagick
# http://cactuslab.com/imagemagick/
# 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"
@vnznznz
Copy link

vnznznz commented Aug 18, 2016

@SpikyOrange You missed:

# Ensure we're running in location of script.
cd "`dirname $0`"

Move the the script to the folder where your images are and run it.

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