Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrejIka/6eacb8c5ae367c4f259affc02bf094dc to your computer and use it in GitHub Desktop.
Save andrejIka/6eacb8c5ae367c4f259affc02bf094dc to your computer and use it in GitHub Desktop.

Revisions

  1. @julianxhokaxhiu julianxhokaxhiu revised this gist Mar 26, 2020. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,6 @@
    #!/bin/bash
    # Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
    find . -type f \( -iname "*.png" -o -iname "*.PNG" \) -exec optipng -nb -nc {} \;
    find . -type f \( -iname "*.png" -o -iname "*.PNG" \) -exec advpng -z4 {} \;
    find . -type f \( -iname "*.png" -o -iname "*.PNG" \) -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
    find . -type f \( -iname "*.jpg" -o -iname "*.JPG" \) -exec jpegoptim -f --strip-all {} \;
    find . -type f \( -iname "*.jpeg" -o -iname "*.JPEG" \) -exec jpegoptim -f --strip-all {} \;
    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 {} \;
  2. @julianxhokaxhiu julianxhokaxhiu revised this gist Mar 26, 2020. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash
    # Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
    find . -type f -name "*.png" -o -name "*.PNG" -exec optipng -nb -nc {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -exec advpng -z4 {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
    find . -type f -name "*.jpg" -o -name "*.JPG" -exec jpegoptim -f --strip-all {} \;
    find . -type f -name "*.jpeg" -o -name "*.JPEG" -exec jpegoptim -f --strip-all {} \;
    find . -type f \( -iname "*.png" -o -iname "*.PNG" \) -exec optipng -nb -nc {} \;
    find . -type f \( -iname "*.png" -o -iname "*.PNG" \) -exec advpng -z4 {} \;
    find . -type f \( -iname "*.png" -o -iname "*.PNG" \) -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
    find . -type f \( -iname "*.jpg" -o -iname "*.JPG" \) -exec jpegoptim -f --strip-all {} \;
    find . -type f \( -iname "*.jpeg" -o -iname "*.JPEG" \) -exec jpegoptim -f --strip-all {} \;
  3. @julianxhokaxhiu julianxhokaxhiu revised this gist Mar 1, 2020. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash
    # Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
    find . -type f -name "*.png" -o -name "*.PNG" -print0 -exec optipng -nb -nc {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -print0 -exec advpng -z4 {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -print0 -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
    find . -type f -name "*.jpg" -o -name "*.JPG" -print0 -exec jpegoptim -f --strip-all {} \;
    find . -type f -name "*.jpeg" -o -name "*.JPEG" -print0 -exec jpegoptim -f --strip-all {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -exec optipng -nb -nc {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -exec advpng -z4 {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
    find . -type f -name "*.jpg" -o -name "*.JPG" -exec jpegoptim -f --strip-all {} \;
    find . -type f -name "*.jpeg" -o -name "*.JPEG" -exec jpegoptim -f --strip-all {} \;
  4. @julianxhokaxhiu julianxhokaxhiu revised this gist Mar 1, 2020. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash
    # Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
    find . -type f -name "*.png" -o -name "*.PNG" -print0 | xargs -0 -I {} optipng -nb -nc "{}"
    find . -type f -name "*.png" -o -name "*.PNG" -print0 | xargs -0 -I {} advpng -z4 "{}"
    find . -type f -name "*.png" -o -name "*.PNG" -print0 | xargs -0 -I {} pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow "{}"
    find . -type f -name "*.jpg" -o -name "*.JPG" -print0 | xargs -0 -I {} jpegoptim -f --strip-all "{}"
    find . -type f -name "*.jpeg" -o -name "*.JPEG" -print0 | xargs -0 -I {} jpegoptim -f --strip-all "{}"
    find . -type f -name "*.png" -o -name "*.PNG" -print0 -exec optipng -nb -nc {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -print0 -exec advpng -z4 {} \;
    find . -type f -name "*.png" -o -name "*.PNG" -print0 -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
    find . -type f -name "*.jpg" -o -name "*.JPG" -print0 -exec jpegoptim -f --strip-all {} \;
    find . -type f -name "*.jpeg" -o -name "*.JPEG" -print0 -exec jpegoptim -f --strip-all {} \;
  5. @julianxhokaxhiu julianxhokaxhiu revised this gist Nov 18, 2019. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #!/bin/bash
    find . -type f -name "*.png" -o -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.png" -o -name "*.PNG" | xargs advpng -z4
    find . -type f -name "*.png" -o -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.jpg" -o -name "*.JPG" | xargs jpegoptim -f --strip-all
    # Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
    find . -type f -name "*.png" -o -name "*.PNG" -print0 | xargs -0 -I {} optipng -nb -nc "{}"
    find . -type f -name "*.png" -o -name "*.PNG" -print0 | xargs -0 -I {} advpng -z4 "{}"
    find . -type f -name "*.png" -o -name "*.PNG" -print0 | xargs -0 -I {} pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow "{}"
    find . -type f -name "*.jpg" -o -name "*.JPG" -print0 | xargs -0 -I {} jpegoptim -f --strip-all "{}"
    find . -type f -name "*.jpeg" -o -name "*.JPEG" -print0 | xargs -0 -I {} jpegoptim -f --strip-all "{}"
  6. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 17, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    #!/bin/bash
    find . -type f -name "*.png" -o -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.png" -o -name "*.PNG" | xargs advpng -z4
    find . -type f -name "*.png" -o -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.jpg" -o -name "*.JPG" | xargs jpegoptim -f --strip-all
  7. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 17, 2015. No changes.
  8. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 17, 2015. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,4 @@
    #!/bin/bash
    find . -type f -name "*.png" | xargs optipng -nb -nc
    find . -type f -name "*.png" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.jpg" | xargs jpegoptim -f --strip-all
    find . -type f -name "*.JPG" | xargs jpegoptim -f --strip-all
    find . -type f -name "*.png" -o -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.png" -o -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.jpg" -o -name "*.JPG" | xargs jpegoptim -f --strip-all
  9. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,6 @@
    find . -type f -name "*.png" | xargs optipng -nb -nc
    find . -type f -name "*.png" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.png" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.jpg" | xargs jpegoptim -f --strip-all
    find . -type f -name "*.JPG" | xargs jpegoptim -f --strip-all
  10. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 17, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #!/bin/bash
    find . -type f -name "*.png" | xargs optipng -nb -nc
    find . -type f -name "*.png" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.jpg" | xargs jpegoptim --strip-all
    find . -type f -name "*.JPG" | xargs jpegoptim --strip-all
    find . -type f -name "*.png" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
    find . -type f -name "*.jpg" | xargs jpegoptim -f --strip-all
    find . -type f -name "*.JPG" | xargs jpegoptim -f --strip-all
  11. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 16, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash
    find . -type f -name "*.png" | xargs optipng -nb -nc
    find . -type f -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.jpg" | xargs jpegoptim --strip-all {} \;
    find . -type f -name "*.JPG" | xargs jpegoptim --strip-all {} \;
    find . -type f -name "*.jpg" | xargs jpegoptim --strip-all
    find . -type f -name "*.JPG" | xargs jpegoptim --strip-all
  12. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 16, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash
    find . -type f -name "*.png" | xargs optipng -nx
    find . -type f -name "*.PNG" | xargs optipng -nx
    find . -type f -name "*.png" | xargs optipng -nb -nc
    find . -type f -name "*.PNG" | xargs optipng -nb -nc
    find . -type f -name "*.jpg" | xargs jpegoptim --strip-all {} \;
    find . -type f -name "*.JPG" | xargs jpegoptim --strip-all {} \;
  13. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 16, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash
    find . -name "*.png" | xargs optipng -nx
    find . -name "*.PNG" | xargs optipng -nx
    find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;
    find -type f -name "*.JPG" -exec jpegoptim --strip-all {} \;
    find . -type f -name "*.png" | xargs optipng -nx
    find . -type f -name "*.PNG" | xargs optipng -nx
    find . -type f -name "*.jpg" | xargs jpegoptim --strip-all {} \;
    find . -type f -name "*.JPG" | xargs jpegoptim --strip-all {} \;
  14. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 16, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash
    find . -name "*.png" | xargs optipng -nc -nb
    find . -name "*.PNG" | xargs optipng -nc -nb
    find . -name "*.png" | xargs optipng -nx
    find . -name "*.PNG" | xargs optipng -nx
    find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;
    find -type f -name "*.JPG" -exec jpegoptim --strip-all {} \;
  15. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 16, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash
    find . -name "*.png" | xargs optipng -nc -nb -o7 -full
    find . -name "*.PNG" | xargs optipng -nc -nb -o7 -full
    find . -name "*.png" | xargs optipng -nc -nb
    find . -name "*.PNG" | xargs optipng -nc -nb
    find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;
    find -type f -name "*.JPG" -exec jpegoptim --strip-all {} \;
  16. @julianxhokaxhiu julianxhokaxhiu revised this gist Dec 16, 2015. No changes.
  17. @julianxhokaxhiu julianxhokaxhiu created this gist Dec 16, 2015.
    5 changes: 5 additions & 0 deletions pagespeed_optimize_images.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/bin/bash
    find . -name "*.png" | xargs optipng -nc -nb -o7 -full
    find . -name "*.PNG" | xargs optipng -nc -nb -o7 -full
    find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;
    find -type f -name "*.JPG" -exec jpegoptim --strip-all {} \;