Skip to content

Instantly share code, notes, and snippets.

@cronnelly
Created October 23, 2012 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cronnelly/3941033 to your computer and use it in GitHub Desktop.
Save cronnelly/3941033 to your computer and use it in GitHub Desktop.
Find PNGs which should be re-encoded to JPG
find . -type f -iname "*.png" -print0 | while read -d $'\0' fn; do os=$(stat -c%s "$fn"); js=$(gm convert -quality 80 "$fn" jpg:- | wc -c); ratio=$(echo "scale=3; ($js * 100) / $os" | bc); echo "$ratio% $js $os $fn"; done | sort -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment