Skip to content

Instantly share code, notes, and snippets.

@amirnissim
Forked from lanceli/downscale.sh
Last active October 22, 2017 11:51
Show Gist options
  • Save amirnissim/77d6fcfbddedec4533cd3ca7aa668e9b to your computer and use it in GitHub Desktop.
Save amirnissim/77d6fcfbddedec4533cd3ca7aa668e9b 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
# macOS find syntax
for file in `find . -type f -name *.png`; do
echo Processing file "$file";
sips -Z $(($(sips -g pixelWidth "$file" | cut -s -d ':' -f 2 | cut -c 2-) / 2)) "$file" --out "$file" &> /dev/null
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment