Skip to content

Instantly share code, notes, and snippets.

@herry13
Forked from lanceli/downscale.sh
Created June 5, 2018 21:01
Show Gist options
  • Save herry13/1d65d6f8647b788a13c9fe63de182c7c to your computer and use it in GitHub Desktop.
Save herry13/1d65d6f8647b788a13c9fe63de182c7c to your computer and use it in GitHub Desktop.
sips downscale image by percentage in Mac OS X
#!/bin/bash
if [ $1 ]
then
echo Processing file $1;
else
for var in `find *.png`;
do
echo Processing file $var;
sips -Z $(($(sips -g pixelWidth "$var" | cut -s -d ':' -f 2 | cut -c 2-) / 2)) "$var" --out "resized_$var" &> /dev/null
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment