Create a gist now

Instantly share code, notes, and snippets.

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
@Lerg
Owner

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

@Lerg
Owner

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