Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am wtfmejt on github.
* I am wtfmejt (https://keybase.io/wtfmejt) on keybase.
* I have a public key ASDM01VhTqkG-WQKTrJyrxCxlA5xJ5bSKxaEfLWvtqC_wQo
To claim this, I am signing this object:
@wtfmejt
wtfmejt / pagespeed_optimize_images.sh
Created April 19, 2020 12:22 — forked from julianxhokaxhiu/pagespeed_optimize_images.sh
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;