Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Automatically downsizes your @4x and @2x images in the current directory

View downsize.sh
1 2 3 4 5 6 7 8 9 10
#!/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

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

Owner
Lerg commented

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
Something went wrong with that request. Please try again.