Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Automatically downsizes your @4x and @2x images in the current directory
#!/bin/sh
ext=$1
for f in $(find . -name "*@4x.$ext"); do
echo "Converting $f..."
convert "$f" -resize '50%' -unsharp 1x4 "$(dirname $f)/$(basename -s "@4x.$ext" $f)@2x.$ext"
done
for f in $(find . -name "*@2x.$ext"); do
echo "Converting $f..."
convert "$f" -resize '50%' -unsharp 1x4 "$(dirname $f)/$(basename -s "@2x.$ext" $f).$ext"
done
Owner
Lerg commented Jun 2, 2014

Usage:
./downsize.sh jpg
./downsize.sh png

Owner
Lerg commented Jun 2, 2014

You need to install ImageMagick for this to work

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