Google optimizer. Bash script to recursive optimize all png and .jpg

First of all install:

sudo apt install jpegoptim


sudo apt install optipng

nesxt make script file in your website folder

touch ./
chmod +x ./

next paste the code to file

nano ./
# Script Google Optimizer
# Autor: Szymon Wójtowicz
# Site:
# Blog:

for f in $(find ./ -name '*.png' -or -name '*.jpg'); 
if [[ $f == *.png ]] ;then
optipng -strip all -o5 "$f";
elif [[ $f == *.jpg ]] ; then
jpegoptim "$f" --strip-all; 

and run with command



next check speed of your site

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

This site uses Akismet to reduce spam. Learn how your comment data is processed.