Optimize images jpg png CentOS Print

  • 3

You want to make your site faster ?  maybe it is then an idea to optimize and compress png or jpg images via your SSH Terminal.
If you got a lots of images you can save many of bytes by just compress images without losing any quality and discrease your website page size.

First we going to install jpegoptim  +  optipng
# yum install optipng
# yum install jpegoptim

How works  optipng ?
optipng file
optipng [options] file
optipng [options] input.png

How works  optipng ?
jpegoptim file.jpeg
jpegoptim [options] file.jpeg
jpegoptim photo.jpeg
First we go check how fast is your website and what your page size is
-   Check your site on:   http://tools.pingdom.com/fpt/
SAMPLE:   1.87s  Load time /  2.3 MB  Page size
-  Check where your most images are  e.g   /wp-content/  or /images/

Now we gonna start optimize  PNG & JPG/JPEG!
#  cd /home/user/domains/domain.com/public_html/wp-content/uploads/ 
# all images in current directory:  jpegoptim *.jpg
# or  jpegoptim  */*.pg (all directories)   or 1 image:  jpegoptim image1.jpg
# all images in current directory:  optipng *.png     
# or  optipng  */*.png (all directories)   or 1 image:  optipng image1.png

More information:

find -type f -name "*.png" -exec optipng {} \;
find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;
find -type f -name "*.jpeg" -exec jpegoptim --strip-all {} \;

Was dit antwoord nuttig?

« Terug