Skip to content

Instantly share code, notes, and snippets.

@jesse-c
Last active August 27, 2019 11:02
Show Gist options
  • Save jesse-c/ac39a2ee76eea2fc1d14ff55bc950623 to your computer and use it in GitHub Desktop.
Save jesse-c/ac39a2ee76eea2fc1d14ff55bc950623 to your computer and use it in GitHub Desktop.
Use pngcrush to recursively optimise and replace PNGs (used on macOS)
#!/bin/sh
find "$1" -type f -iname '*.png' -print0 | while IFS= read -r -d '' file; do
echo "crushing $file"
pngcrush -rem alla -reduce -brute "$file" temp.png
mv -f temp.png "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment