Learn about Centmin Mod LEMP Stack today
Become a Member

Playing with EWWW Image Optimizer Wordpress Plugin

Discussion in 'Blogs & CMS usage' started by eva2000, Aug 15, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Thought I'd check out EWWW Image Optimizer Wordpress plugin on Centmin Mod 123.09beta01 LEMP web stack with CentOS 7.3 64bit server :) Then play with WebP image conversion support in Centmin Mod Nginx :D

    Official docs at EWWW I.O. Documentation

    ewww-image-optimizer-dashboard1.png ewww-image-optimizer-dashboard1b.png ewww-image-optimizer-dashboard2.png ewww-image-optimizer-dashboard3.png ewww-image-optimizer-dashboard4.png ewww-image-optimizer-dashboard5.png ewww-image-optimizer-dashboard6.png ewww-image-optimizer-dashboard6-cacheenabler.png
    Bulk Optimizer


    ewww-image-optimizer-dashboard7.png ewww-image-optimizer-dashboard8.png ewww-image-optimizer-dashboard8b.png
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Combined with Imsanity Wordpress plugin to auto optimize uploaded images, does wonders !

    wp-imsanity-01.png wp-imsanity-02.png

    upload auto optimized and resized = 330KB

    wp-imsanity-03.png
    without Imsanity uploaded original image = 6 megabytes in size !

    wp-imsanity-03b.png
     
  3. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    EWWW Image Optimizer also supports WP-CLI command line optimisations too Optimizing with WP-CLI - EWWW I.O. Documentation

    --force reoptimises existing images if you don't want to do that, just remove --force flag
    Code (Text):
    cd /home/nginx/domains/domain.com/public/
    wp ewwwio optimize media 1 --force --allow-root
    chown -R nginx:nginx /home/nginx/domains/domain.com/public/
    

    example output
    Code (Text):
    wp ewwwio optimize media 1 --force --allow-root
    Forcing re-optimization of previously processed images.
    Optimizing media with a 1 second pause between images.
    3 images in the Media Library have been selected.
    The active theme, BuddyPress, WP Symposium, and folders that you have configured will also be scanned for unoptimized images.
    Scanning, this could take a while
    There are 26 images ready to optimize. [y/n] y
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2.jpeg
    Reduced by 4.6% (15.1 KB) - Previously Optimized
    Elapsed: 2 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2-150x150.jpeg
    Reduced by 0.7% (37 B) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2-300x200.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2-768x512.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2-1024x683.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2-2000x1200.jpeg
    Reduced by 3.7% (10.0 KB) - Previously Optimized
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2-100x100.jpeg
    Reduced by 5.6% (166 B) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164.jpeg
    Reduced by 5.7% (405.2 KB) - Previously Optimized
    Elapsed: 24 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-150x150.jpeg
    Reduced by 0.7% (35 B) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-300x200.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-768x512.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-1024x683.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-2000x1200.jpeg
    Reduced by 4.6% (13.7 KB) - Previously Optimized
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-434164-100x100.jpeg
    Reduced by 5.8% (174 B) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710.jpeg
    Reduced by 1.9% (126.2 KB) - Previously Optimized
    Elapsed: 13 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710-150x150.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710-300x197.jpeg
    No savings
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710-768x505.jpeg
    Reduced by 4.6% (4.8 KB) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710-1024x673.jpeg
    Reduced by 3.8% (6.5 KB) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710-2000x1200.jpeg
    Reduced by 2.9% (15.1 KB) - Previously Optimized
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/pexels-photo-374710-100x100.jpeg
    Reduced by 1.4% (61 B) - Previously Optimized
    Elapsed: 0 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/themes/twentyseventeen/assets/images/coffee.jpg
    No savings
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/themes/twentyseventeen/assets/images/sandwich.jpg
    No savings
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/themes/twentyseventeen/assets/images/espresso.jpg
    No savings
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/themes/twentyseventeen/assets/images/header.jpg
    No savings
    Elapsed: 1 seconds
    Optimized /home/nginx/domains/domain.com/public/wp-content/themes/twentyseventeen/screenshot.png
    Reduced by 0.5% (1.7 KB) - Previously Optimized
    Elapsed: 3 seconds
    Success: Finished Optimization!
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    EWWW Image Optimizer also can optionally enable WebP image conversion which works with Centmin Mod 123.09beta01's default webp dynamic image support allowing only supported web browsers to receive the WebP version, while other web browsers get the normal optimised JPG/PNG copies.

    As outlined at Nginx Serving WebP Images Conditionally Demo in Centmin Mod 123.09beta01 if you use something like below in Wordpress Nginx vhost file i.e. /usr/local/nginx/conf/conf.d/domain.com.conf
    Code (Text):
    location /wp-content/uploads/2017 {
      #pagespeed off;
      autoindex off;
      #add_header X-Robots-Tag "noindex, nofollow";
      location ~* ^/wp-content/uploads/2017/.+\.(png|jpe?g)$ {
        expires 30d;
        add_header Vary "Accept";
        add_header Cache-Control "public, no-transform";
        try_files $uri$webp_extension $uri =404;
      }
    }
    

    Then supported WebP browsers will receive WebP converted files - dev tool network tab -> Type = webp

    wp-ewww-demo-devtools-network-webp-images-00.png

    EWWW Image Optimizer converted images in Wordpress upload directory /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    Code (Text):
    ls -lahR /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/:
    total 22M
    drwxr-sr-x 2 nginx nginx 8.0K Aug 15 08:44 .
    drwxr-sr-x 3 nginx nginx   15 Aug 15 02:17 ..
    -rw-r--r-- 1 nginx nginx 3.3K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-100x100.png
    -rw-r--r-- 1 nginx nginx 3.0K Aug 15 08:44 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-100x100.png.webp
    -rw-r--r-- 1 nginx nginx 193K Aug 15 08:44 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1024x1024.png
    -rw-r--r-- 1 nginx nginx 155K Aug 15 08:44 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1024x1024.png.webp
    -rw-r--r-- 1 nginx nginx 269K Aug 15 08:44 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1280x1200.png
    -rw-r--r-- 1 nginx nginx 207K Aug 15 08:44 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1280x1200.png.webp
    -rw-r--r-- 1 nginx nginx 6.9K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-150x150.png
    -rw-r--r-- 1 nginx nginx 6.3K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-150x150.png.webp
    -rw-r--r-- 1 nginx nginx  27K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-300x300.png
    -rw-r--r-- 1 nginx nginx  24K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-300x300.png.webp
    -rw-r--r-- 1 nginx nginx 125K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-768x768.png
    -rw-r--r-- 1 nginx nginx 106K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-768x768.png.webp
    -rw-r--r-- 1 nginx nginx 269K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f.png
    -rw-r--r-- 1 nginx nginx 207K Aug 15 08:43 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f.png.webp
    -rw-r--r-- 1 nginx nginx 5.0K Aug 15 08:43 7a69d4_optimised-100x100.png
    -rw-r--r-- 1 nginx nginx 4.5K Aug 15 08:43 7a69d4_optimised-100x100.png.webp
    -rw-r--r-- 1 nginx nginx  11K Aug 15 08:43 7a69d4_optimised-150x150.png
    -rw-r--r-- 1 nginx nginx  11K Aug 15 08:43 7a69d4_optimised-150x150.png.webp
    -rw-r--r-- 1 nginx nginx  37K Aug 15 08:43 7a69d4_optimised-300x282.png
    -rw-r--r-- 1 nginx nginx  33K Aug 15 08:43 7a69d4_optimised-300x282.png.webp
    -rw-r--r-- 1 nginx nginx 172K Aug 15 08:43 7a69d4_optimised-768x723.png
    -rw-r--r-- 1 nginx nginx 146K Aug 15 08:43 7a69d4_optimised-768x723.png.webp
    -rw-r--r-- 1 nginx nginx 206K Aug 15 08:43 7a69d4_optimised.png
    -rw-r--r-- 1 nginx nginx 182K Aug 15 08:43 7a69d4_optimised.png.webp
    -rw-r--r-- 1 nginx nginx 4.1K Aug 15 03:02 pexels-photo-374710-100x100.jpeg
    -rw-r--r-- 1 nginx nginx 2.9K Aug 15 07:04 pexels-photo-374710-100x100.jpeg.webp
    -rw-r--r-- 1 nginx nginx 165K Aug 15 03:02 pexels-photo-374710-1024x673.jpeg
    -rw-r--r-- 1 nginx nginx 104K Aug 15 07:04 pexels-photo-374710-1024x673.jpeg.webp
    -rw-r--r-- 1 nginx nginx 8.0K Aug 15 03:01 pexels-photo-374710-150x150.jpeg
    -rw-r--r-- 1 nginx nginx 5.9K Aug 15 07:04 pexels-photo-374710-150x150.jpeg.webp
    -rw-r--r-- 1 nginx nginx 503K Aug 15 03:02 pexels-photo-374710-2000x1200.jpeg
    -rw-r--r-- 1 nginx nginx 292K Aug 15 07:04 pexels-photo-374710-2000x1200.jpeg.webp
    -rw-r--r-- 1 nginx nginx  19K Aug 15 03:01 pexels-photo-374710-300x197.jpeg
    -rw-r--r-- 1 nginx nginx  13K Aug 15 07:04 pexels-photo-374710-300x197.jpeg.webp
    -rw-r--r-- 1 nginx nginx  98K Aug 15 03:02 pexels-photo-374710-768x505.jpeg
    -rw-r--r-- 1 nginx nginx  65K Aug 15 07:04 pexels-photo-374710-768x505.jpeg.webp
    -rw-r--r-- 1 nginx nginx 6.4M Aug 15 03:02 pexels-photo-374710.jpeg
    -rw-r--r-- 1 nginx nginx 2.1M Aug 15 07:04 pexels-photo-374710.jpeg.webp
    -rw-r--r-- 1 nginx nginx 2.8K Aug 15 04:27 pexels-photo-434164-100x100.jpeg
    -rw-r--r-- 1 nginx nginx 1.6K Aug 15 07:03 pexels-photo-434164-100x100.jpeg.webp
    -rw-r--r-- 1 nginx nginx  91K Aug 15 04:26 pexels-photo-434164-1024x683.jpeg
    -rw-r--r-- 1 nginx nginx  53K Aug 15 07:03 pexels-photo-434164-1024x683.jpeg.webp
    -rw-r--r-- 1 nginx nginx 5.0K Aug 15 04:27 pexels-photo-434164-150x150.jpeg
    -rw-r--r-- 1 nginx nginx 3.0K Aug 15 07:03 pexels-photo-434164-150x150.jpeg.webp
    -rw-r--r-- 1 nginx nginx 284K Aug 15 04:27 pexels-photo-434164-2000x1200.jpeg
    -rw-r--r-- 1 nginx nginx 159K Aug 15 07:03 pexels-photo-434164-2000x1200.jpeg.webp
    -rw-r--r-- 1 nginx nginx 2.8K Aug 15 05:21 pexels-photo-434164-2-100x100.jpeg
    -rw-r--r-- 1 nginx nginx 1.6K Aug 15 07:03 pexels-photo-434164-2-100x100.jpeg.webp
    -rw-r--r-- 1 nginx nginx  88K Aug 15 05:21 pexels-photo-434164-2-1024x683.jpeg
    -rw-r--r-- 1 nginx nginx  49K Aug 15 07:03 pexels-photo-434164-2-1024x683.jpeg.webp
    -rw-r--r-- 1 nginx nginx 5.0K Aug 15 05:21 pexels-photo-434164-2-150x150.jpeg
    -rw-r--r-- 1 nginx nginx 3.0K Aug 15 07:03 pexels-photo-434164-2-150x150.jpeg.webp
    -rw-r--r-- 1 nginx nginx 262K Aug 15 05:21 pexels-photo-434164-2-2000x1200.jpeg
    -rw-r--r-- 1 nginx nginx 135K Aug 15 07:03 pexels-photo-434164-2-2000x1200.jpeg.webp
    -rw-r--r-- 1 nginx nginx  11K Aug 15 05:21 pexels-photo-434164-2-300x200.jpeg
    -rw-r--r-- 1 nginx nginx 6.1K Aug 15 07:03 pexels-photo-434164-2-300x200.jpeg.webp
    -rw-r--r-- 1 nginx nginx  53K Aug 15 05:21 pexels-photo-434164-2-768x512.jpeg
    -rw-r--r-- 1 nginx nginx  30K Aug 15 07:03 pexels-photo-434164-2-768x512.jpeg.webp
    -rw-r--r-- 1 nginx nginx 316K Aug 15 05:21 pexels-photo-434164-2.jpeg
    -rw-r--r-- 1 nginx nginx 173K Aug 15 07:03 pexels-photo-434164-2.jpeg.webp
    -rw-r--r-- 1 nginx nginx  11K Aug 15 04:26 pexels-photo-434164-300x200.jpeg
    -rw-r--r-- 1 nginx nginx 6.2K Aug 15 07:03 pexels-photo-434164-300x200.jpeg.webp
    -rw-r--r-- 1 nginx nginx  54K Aug 15 04:26 pexels-photo-434164-768x512.jpeg
    -rw-r--r-- 1 nginx nginx  32K Aug 15 07:03 pexels-photo-434164-768x512.jpeg.webp
    -rw-r--r-- 1 nginx nginx 6.5M Aug 15 04:26 pexels-photo-434164.jpeg
    -rw-r--r-- 1 nginx nginx 1.4M Aug 15 07:03 pexels-photo-434164.jpeg.webp
    
     
    Last edited: Dec 12, 2019
  5. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Next up is comparing EWWW Image Optimizer to my own shell based script, optimise-images.sh just for Wordpress upload directory at /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/. The is an outline for a truly 100% free Wordpress image optimisation method compared to the normal Wordpress image optimisation plugins which have limited free tiers with paid cloud based service tiers if you want more features (lossy optimisations or charged $$$ per image).

    I expect my script will optimise and reduces more as EWWW does lossless image optimisation for free version, and AFAIK only lossy optimisations are supported in their paid Cloud based server offerings. Also my optimise-images.sh script by default resizes to 2048 pixel width only if images are >2048 pixel width (MAXRES='2048' & IMAGICK_RESIZE='y' by default). Note Imsanity's default resize threshold is also 2048 pixels which when installed overrides EWWW Image Optimizer settings to same as well.

    First up installing optimise-images.sh
    Code (Text):
    mkdir -p /root/tools
    cd /root/tools
    git clone --depth=1 https://github.com/centminmod/optimise-images
    

    original on disk size for directory /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    Code (Text):
    du -s /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    22312   /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    

    optimise-images.sh profile mode to see existing images info with IMAGICK_WEBP='y' (defaults to 'n') and IMAGICK_WEBPLOSSLESS='n' (kept at lossless as lossy 'y' results in large WebP images for some reason).

    Note
    • optimise-images.sh only works on JPG, PNG and optionally WebP images
    • the WebP and JPG/PNG images profile mode is broken down into separate summaries and WebP header is technically incorrect in profile mode = Optimised WebP Images. The header is for when running optimise mode as you will see further down below.
    Code (Text):
    ./optimise-images.sh profile /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    
    ------------------------------------------------------------------------------
    image profile
    image name : width : height : quality : transparency : image depth (bits) : size : user: group
    ------------------------------------------------------------------------------
    images in /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    logged at /home/optimise-logs/profile-log-150817-193057.log
    ------------------------------------------------------------------------------
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-100x100.png : 100 : 100 : 92 : False : 8 : 3362 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-100x100.png.webp : 100 : 100 : 100 : False : 8 : 3022 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1024x1024.png : 1024 : 1024 : 92 : False : 8 : 197168 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1024x1024.png.webp : 1024 : 1024 : 100 : False : 8 : 158482 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1280x1200.png : 1280 : 1200 : 92 : False : 8 : 274504 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1280x1200.png.webp : 1280 : 1200 : 100 : False : 8 : 211118 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-150x150.png : 150 : 150 : 92 : False : 8 : 7050 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-150x150.png.webp : 150 : 150 : 100 : False : 8 : 6384 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-300x300.png : 300 : 300 : 92 : False : 8 : 26655 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-300x300.png.webp : 300 : 300 : 100 : False : 8 : 24028 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-768x768.png : 768 : 768 : 92 : False : 8 : 127201 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-768x768.png.webp : 768 : 768 : 100 : False : 8 : 107716 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f.png : 1280 : 1280 : 92 : False : 8 : 274876 : nginx : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f.png.webp : 1280 : 1280 : 100 : False : 8 : 211488 : nginx : nginx
    image : 7a69d4_optimised-100x100.png : 100 : 100 : 92 : False : 8 : 5043 : nginx : nginx
    image : 7a69d4_optimised-100x100.png.webp : 100 : 100 : 100 : False : 8 : 4578 : nginx : nginx
    image : 7a69d4_optimised-150x150.png : 150 : 150 : 92 : False : 8 : 11087 : nginx : nginx
    image : 7a69d4_optimised-150x150.png.webp : 150 : 150 : 100 : False : 8 : 10256 : nginx : nginx
    image : 7a69d4_optimised-300x282.png : 300 : 282 : 92 : False : 8 : 36944 : nginx : nginx
    image : 7a69d4_optimised-300x282.png.webp : 300 : 282 : 100 : False : 8 : 33760 : nginx : nginx
    image : 7a69d4_optimised-768x723.png : 768 : 723 : 92 : False : 8 : 175237 : nginx : nginx
    image : 7a69d4_optimised-768x723.png.webp : 768 : 723 : 100 : False : 8 : 148564 : nginx : nginx
    image : 7a69d4_optimised.png : 984 : 926 : 92 : False : 8 : 210774 : nginx : nginx
    image : 7a69d4_optimised.png.webp : 984 : 926 : 100 : False : 8 : 185456 : nginx : nginx
    image : pexels-photo-374710-100x100.jpeg : 100 : 100 : 82 : False : 8 : 4182 : nginx : nginx
    image : pexels-photo-374710-100x100.jpeg.webp : 100 : 100 : 92 : False : 8 : 2926 : nginx : nginx
    image : pexels-photo-374710-1024x673.jpeg : 1024 : 673 : 82 : False : 8 : 167957 : nginx : nginx
    image : pexels-photo-374710-1024x673.jpeg.webp : 1024 : 673 : 92 : False : 8 : 105816 : nginx : nginx
    image : pexels-photo-374710-150x150.jpeg : 150 : 150 : 82 : False : 8 : 8161 : nginx : nginx
    image : pexels-photo-374710-150x150.jpeg.webp : 150 : 150 : 92 : False : 8 : 5982 : nginx : nginx
    image : pexels-photo-374710-2000x1200.jpeg : 2000 : 1200 : 82 : False : 8 : 514940 : nginx : nginx
    image : pexels-photo-374710-2000x1200.jpeg.webp : 2000 : 1200 : 92 : False : 8 : 298022 : nginx : nginx
    image : pexels-photo-374710-300x197.jpeg : 300 : 197 : 82 : False : 8 : 18507 : nginx : nginx
    image : pexels-photo-374710-300x197.jpeg.webp : 300 : 197 : 92 : False : 8 : 13174 : nginx : nginx
    image : pexels-photo-374710-768x505.jpeg : 768 : 505 : 82 : False : 8 : 100266 : nginx : nginx
    image : pexels-photo-374710-768x505.jpeg.webp : 768 : 505 : 92 : False : 8 : 66316 : nginx : nginx
    image : pexels-photo-374710.jpeg : 5498 : 3615 : 94 : False : 8 : 6641052 : nginx : nginx
    image : pexels-photo-374710.jpeg.webp : 5498 : 3615 : 92 : False : 8 : 2190452 : nginx : nginx
    image : pexels-photo-434164-100x100.jpeg : 100 : 100 : 82 : False : 8 : 2813 : nginx : nginx
    image : pexels-photo-434164-100x100.jpeg.webp : 100 : 100 : 92 : False : 8 : 1620 : nginx : nginx
    image : pexels-photo-434164-1024x683.jpeg : 1024 : 683 : 82 : False : 8 : 92907 : nginx : nginx
    image : pexels-photo-434164-1024x683.jpeg.webp : 1024 : 683 : 92 : False : 8 : 53464 : nginx : nginx
    image : pexels-photo-434164-150x150.jpeg : 150 : 150 : 82 : False : 8 : 5111 : nginx : nginx
    image : pexels-photo-434164-150x150.jpeg.webp : 150 : 150 : 92 : False : 8 : 3034 : nginx : nginx
    image : pexels-photo-434164-2000x1200.jpeg : 2000 : 1200 : 82 : False : 8 : 290397 : nginx : nginx
    image : pexels-photo-434164-2000x1200.jpeg.webp : 2000 : 1200 : 92 : False : 8 : 162020 : nginx : nginx
    image : pexels-photo-434164-2-100x100.jpeg : 100 : 100 : 82 : False : 8 : 2804 : nginx : nginx
    image : pexels-photo-434164-2-100x100.jpeg.webp : 100 : 100 : 92 : False : 8 : 1572 : nginx : nginx
    image : pexels-photo-434164-2-1024x683.jpeg : 1024 : 683 : 82 : False : 8 : 89512 : nginx : nginx
    image : pexels-photo-434164-2-1024x683.jpeg.webp : 1024 : 683 : 92 : False : 8 : 49724 : nginx : nginx
    image : pexels-photo-434164-2-150x150.jpeg : 150 : 150 : 82 : False : 8 : 5067 : nginx : nginx
    image : pexels-photo-434164-2-150x150.jpeg.webp : 150 : 150 : 92 : False : 8 : 2970 : nginx : nginx
    image : pexels-photo-434164-2-2000x1200.jpeg : 2000 : 1200 : 82 : False : 8 : 267901 : nginx : nginx
    image : pexels-photo-434164-2-2000x1200.jpeg.webp : 2000 : 1200 : 92 : False : 8 : 137358 : nginx : nginx
    image : pexels-photo-434164-2-300x200.jpeg : 300 : 200 : 82 : False : 8 : 10719 : nginx : nginx
    image : pexels-photo-434164-2-300x200.jpeg.webp : 300 : 200 : 92 : False : 8 : 6232 : nginx : nginx
    image : pexels-photo-434164-2-768x512.jpeg : 768 : 512 : 82 : False : 8 : 53649 : nginx : nginx
    image : pexels-photo-434164-2-768x512.jpeg.webp : 768 : 512 : 92 : False : 8 : 30284 : nginx : nginx
    image : pexels-photo-434164-2.jpeg : 2048 : 1365 : 82 : False : 8 : 322571 : nginx : nginx
    image : pexels-photo-434164-2.jpeg.webp : 2048 : 1365 : 92 : False : 8 : 176632 : nginx : nginx
    image : pexels-photo-434164-300x200.jpeg : 300 : 200 : 82 : False : 8 : 10775 : nginx : nginx
    image : pexels-photo-434164-300x200.jpeg.webp : 300 : 200 : 92 : False : 8 : 6274 : nginx : nginx
    image : pexels-photo-434164-768x512.jpeg : 768 : 512 : 82 : False : 8 : 54784 : nginx : nginx
    image : pexels-photo-434164-768x512.jpeg.webp : 768 : 512 : 92 : False : 8 : 31898 : nginx : nginx
    image : pexels-photo-434164.jpeg : 7768 : 5178 : 94 : False : 8 : 6809611 : nginx : nginx
    image : pexels-photo-434164.jpeg.webp : 7768 : 5178 : 92 : False : 8 : 1418620 : nginx : nginx
    
    ------------------------------------------------------------------------------
    Original or Existing Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 1077      | 778        | 86          | 509806     | 16823587           | 16429           |
    
    ------------------------------------------------------------------------------
    Optimised WebP Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 1077      | 778        | 95          | 177856     | 5869242            | 5732            |
    
    ------------------------------------------------------------------------------
    ImageMagick Resource Limits
    ------------------------------------------------------------------------------
    Version: ImageMagick 6.9.9-7 Q16 x86_64 2017-08-13
    Resource limits:
      Width: 214.7MP
      Height: 214.7MP
      Area: 3.8578GP
      Memory: 1.79645GiB
      Map: 3.5929GiB
      Disk: unlimited
      File: 196608
      Thread: 2
      Throttle: 0
      Time: unlimited
    ------------------------------------------------------------------------------
    Completion Time: 3.90 seconds
    ------------------------------------------------------------------------------
    

    now lets first remove the existing .webp images created by EWWW Image Optimizer as optimise-images.sh with IMAGICK_WEBP='y' set will convert JPG/PNG images with a separate copy for .webp format
    Code (Text):
    cd /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    find . -maxdepth 1 -name '*.webp' -print
    find . -maxdepth 1 -name '*.webp' -exec rm -rf {} \;
    

    Now let's run installed optimise-images.sh - you'll have a lot of verbose output which is normal + chown command run to make sure files are owned by nginx user/group if you're on Centmin Mod LEMP stacks.
    Code (Text):
    cd /root/tools/optimise-images
    ./optimise-images.sh optimise /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    chown -R nginx:nginx /home/nginx/domains/domain.com/public/wp-content/upload/2017/
    

    Once optimise mode is run check the revised directory size. Size dropped from EWWW based optimised 22,312 kilobytes to 6,016 kilobytes
    Code (Text):
    du -s /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    6016    /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    

    Re-run profile mode to compare
    Code (Text):
    ./optimise-images.sh profile /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    
    ------------------------------------------------------------------------------
    image profile
    image name : width : height : quality : transparency : image depth (bits) : size : user: group
    ------------------------------------------------------------------------------
    images in /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    logged at /home/optimise-logs/profile-log-150817-193445.log
    ------------------------------------------------------------------------------
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-100x100.png : 100 : 100 : 92 : False : 8 : 3362 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-100x100.png.webp : 100 : 100 : 92 : False : 8 : 662 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1024x1024.png : 1024 : 1024 : 92 : False : 8 : 197168 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1024x1024.png.webp : 1024 : 1024 : 92 : False : 8 : 20866 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1280x1200.png : 1280 : 1200 : 92 : False : 8 : 274504 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-1280x1200.png.webp : 1280 : 1200 : 92 : False : 8 : 28646 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-150x150.png : 150 : 150 : 92 : False : 8 : 7050 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-150x150.png.webp : 150 : 150 : 92 : False : 8 : 1120 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-300x300.png : 300 : 300 : 92 : False : 8 : 26667 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-300x300.png.webp : 300 : 300 : 92 : False : 8 : 3244 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-768x768.png : 768 : 768 : 92 : False : 8 : 127201 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f-768x768.png.webp : 768 : 768 : 92 : False : 8 : 14012 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f.png : 1280 : 1280 : 92 : False : 8 : 274876 : root : nginx
    image : 7a69d4_be774ffd6de149d4beb472fb689253e8-mv2.png.cbb4e30c1d50329467efed2e919cbe7f.png.webp : 1280 : 1280 : 92 : False : 8 : 28828 : root : nginx
    image : 7a69d4_optimised-100x100.png : 100 : 100 : 92 : False : 8 : 5043 : root : nginx
    image : 7a69d4_optimised-100x100.png.webp : 100 : 100 : 92 : False : 8 : 880 : root : nginx
    image : 7a69d4_optimised-150x150.png : 150 : 150 : 92 : False : 8 : 11098 : root : nginx
    image : 7a69d4_optimised-150x150.png.webp : 150 : 150 : 92 : False : 8 : 1602 : root : nginx
    image : 7a69d4_optimised-300x282.png : 300 : 282 : 92 : False : 8 : 36944 : root : nginx
    image : 7a69d4_optimised-300x282.png.webp : 300 : 282 : 92 : False : 8 : 4732 : root : nginx
    image : 7a69d4_optimised-768x723.png : 768 : 723 : 92 : False : 8 : 175237 : root : nginx
    image : 7a69d4_optimised-768x723.png.webp : 768 : 723 : 92 : False : 8 : 19476 : root : nginx
    image : 7a69d4_optimised.png : 984 : 926 : 92 : False : 8 : 210774 : root : nginx
    image : 7a69d4_optimised.png.webp : 984 : 926 : 92 : False : 8 : 28290 : root : nginx
    image : pexels-photo-374710-100x100.jpeg : 100 : 100 : 82 : False : 8 : 4160 : nginx : nginx
    image : pexels-photo-374710-100x100.jpeg.webp : 100 : 100 : 92 : False : 8 : 2832 : root : nginx
    image : pexels-photo-374710-1024x673.jpeg : 1024 : 673 : 82 : False : 8 : 167648 : nginx : nginx
    image : pexels-photo-374710-1024x673.jpeg.webp : 1024 : 673 : 92 : False : 8 : 101102 : root : nginx
    image : pexels-photo-374710-150x150.jpeg : 150 : 150 : 82 : False : 8 : 8131 : nginx : nginx
    image : pexels-photo-374710-150x150.jpeg.webp : 150 : 150 : 92 : False : 8 : 5740 : root : nginx
    image : pexels-photo-374710-2000x1200.jpeg : 2000 : 1200 : 82 : False : 8 : 514187 : nginx : nginx
    image : pexels-photo-374710-2000x1200.jpeg.webp : 2000 : 1200 : 92 : False : 8 : 283650 : root : nginx
    image : pexels-photo-374710-300x197.jpeg : 300 : 197 : 82 : False : 8 : 18458 : nginx : nginx
    image : pexels-photo-374710-300x197.jpeg.webp : 300 : 197 : 92 : False : 8 : 12746 : root : nginx
    image : pexels-photo-374710-768x505.jpeg : 768 : 505 : 82 : False : 8 : 100123 : nginx : nginx
    image : pexels-photo-374710-768x505.jpeg.webp : 768 : 505 : 92 : False : 8 : 63800 : root : nginx
    image : pexels-photo-374710.jpeg : 2048 : 1347 : 82 : False : 8 : 576129 : nginx : nginx
    image : pexels-photo-374710.jpeg.webp : 2048 : 1347 : 92 : False : 8 : 319122 : root : nginx
    image : pexels-photo-434164-100x100.jpeg : 100 : 100 : 82 : False : 8 : 2782 : nginx : nginx
    image : pexels-photo-434164-100x100.jpeg.webp : 100 : 100 : 92 : False : 8 : 1552 : root : nginx
    image : pexels-photo-434164-1024x683.jpeg : 1024 : 683 : 82 : False : 8 : 92623 : nginx : nginx
    image : pexels-photo-434164-1024x683.jpeg.webp : 1024 : 683 : 92 : False : 8 : 50726 : root : nginx
    image : pexels-photo-434164-150x150.jpeg : 150 : 150 : 82 : False : 8 : 5090 : nginx : nginx
    image : pexels-photo-434164-150x150.jpeg.webp : 150 : 150 : 92 : False : 8 : 2912 : root : nginx
    image : pexels-photo-434164-2000x1200.jpeg : 2000 : 1200 : 82 : False : 8 : 290026 : nginx : nginx
    image : pexels-photo-434164-2000x1200.jpeg.webp : 2000 : 1200 : 92 : False : 8 : 153468 : root : nginx
    image : pexels-photo-434164-2-100x100.jpeg : 100 : 100 : 82 : False : 8 : 2767 : nginx : nginx
    image : pexels-photo-434164-2-100x100.jpeg.webp : 100 : 100 : 92 : False : 8 : 1478 : root : nginx
    image : pexels-photo-434164-2-1024x683.jpeg : 1024 : 683 : 82 : False : 8 : 89377 : nginx : nginx
    image : pexels-photo-434164-2-1024x683.jpeg.webp : 1024 : 683 : 92 : False : 8 : 46652 : root : nginx
    image : pexels-photo-434164-2-150x150.jpeg : 150 : 150 : 82 : False : 8 : 5030 : nginx : nginx
    image : pexels-photo-434164-2-150x150.jpeg.webp : 150 : 150 : 92 : False : 8 : 2814 : root : nginx
    image : pexels-photo-434164-2-2000x1200.jpeg : 2000 : 1200 : 82 : False : 8 : 267790 : nginx : nginx
    image : pexels-photo-434164-2-2000x1200.jpeg.webp : 2000 : 1200 : 92 : False : 8 : 129420 : root : nginx
    image : pexels-photo-434164-2-300x200.jpeg : 300 : 200 : 82 : False : 8 : 10681 : nginx : nginx
    image : pexels-photo-434164-2-300x200.jpeg.webp : 300 : 200 : 92 : False : 8 : 5858 : root : nginx
    image : pexels-photo-434164-2-768x512.jpeg : 768 : 512 : 82 : False : 8 : 53547 : nginx : nginx
    image : pexels-photo-434164-2-768x512.jpeg.webp : 768 : 512 : 92 : False : 8 : 28646 : root : nginx
    image : pexels-photo-434164-2.jpeg : 2048 : 1365 : 82 : False : 8 : 322053 : nginx : nginx
    image : pexels-photo-434164-2.jpeg.webp : 2048 : 1365 : 92 : False : 8 : 167744 : root : nginx
    image : pexels-photo-434164-300x200.jpeg : 300 : 200 : 82 : False : 8 : 10739 : nginx : nginx
    image : pexels-photo-434164-300x200.jpeg.webp : 300 : 200 : 92 : False : 8 : 5958 : root : nginx
    image : pexels-photo-434164-768x512.jpeg : 768 : 512 : 82 : False : 8 : 54687 : nginx : nginx
    image : pexels-photo-434164-768x512.jpeg.webp : 768 : 512 : 92 : False : 8 : 30408 : root : nginx
    image : pexels-photo-434164.jpeg : 2048 : 1365 : 82 : False : 8 : 324373 : nginx : nginx
    image : pexels-photo-434164.jpeg.webp : 2048 : 1365 : 92 : False : 8 : 168998 : root : nginx
    
    ------------------------------------------------------------------------------
    Original or Existing Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 799       | 594        | 86          | 129404     | 4270325            | 4170            |
    
    ------------------------------------------------------------------------------
    Optimised WebP Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 799       | 594        | 92          | 52666      | 1737984            | 1697            |
    
    ------------------------------------------------------------------------------
    ImageMagick Resource Limits
    ------------------------------------------------------------------------------
    Version: ImageMagick 6.9.9-7 Q16 x86_64 2017-08-13
    Resource limits:
      Width: 214.7MP
      Height: 214.7MP
      Area: 3.8578GP
      Memory: 1.79645GiB
      Map: 3.5929GiB
      Disk: unlimited
      File: 196608
      Thread: 2
      Throttle: 0
      Time: unlimited
    ------------------------------------------------------------------------------
    Completion Time: 1.78 seconds
    ------------------------------------------------------------------------------
    

    EWWW profile breakdown of images
    Code (Text):
    ------------------------------------------------------------------------------
    Original or Existing Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 1077      | 778        | 86          | 509806     | 16823587           | 16429           |
    
    ------------------------------------------------------------------------------
    Optimised WebP Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 1077      | 778        | 95          | 177856     | 5869242            | 5732            |
    

    optimise-images.sh profile breakdown with WebP lossless IMAGICK_WEBP='y' and IMAGICK_WEBPLOSSLESS='n' after optimisation. The JPG + PNG total size dropped ~74.6% in size from 16,429 KB to 4,170 KB (lossy and resized) and WebP image size dropped ~27.3% from 5,732 KB to 4,170 KB.
    Code (Text):
    ------------------------------------------------------------------------------
    Original or Existing Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 799       | 594        | 86          | 129404     | 4270325            | 4170            |
    
    ------------------------------------------------------------------------------
    Optimised WebP Images:
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 799       | 594        | 92          | 52666      | 1737984            | 1697            |
    


    Comparing front end image size for Wordpress with Nginx WebP support enabled

    Code (Text):
    location /wp-content/uploads/2017 {
      #pagespeed off;
      autoindex off;
      #add_header X-Robots-Tag "noindex, nofollow";
      location ~* ^/wp-content/uploads/2017/.+\.(png|jpe?g)$ {
       expires 30d;
       add_header Vary "Accept";
       add_header Cache-Control "public, no-transform";
       try_files $uri$webp_extension $uri =404;
      }
    }
    


    EWWW Image Optimizer

    image-optimiser-sh-02-before.png
    optimise-images.sh

    image-optimiser-sh-02-after.png

    Comparing front end image size for Wordpress without Nginx WebP support enabled. You can see no difference due to
    • optimise-images.sh skips resizing images less than 2048 pixel width and as Wordpress by default creates 4 different resize src set images, thus resulting in little or no difference compared to above with Nginx WebP enabled. WebP format results in lower image sizes even if there is no resizing involved.
    EWWW

    image-optimiser-sh-02-before-nowebp.png

    optimise-images.sh

    image-optimiser-sh-02-after-nowebp.png

    Comparing 2 of the largest JPG images' optimise-image.sh profile data.
    • You can see pexels-photo-434164-2.jpeg was already pretty optimised so no change in file size much and as optimise-images.sh doesn't resize if image is =< 2048 pixel width. While pexels-photo-434164.jpeg was resized from 7768x5178 to 2048x1365 and thus resulted in dramatic drop in image size from 6,809,611 bytes to 324,373 bytes.
    • WebP versions were also similarly processed with only 2nd image pexels-photo-434164.jpeg getting a resize so WebP version dropped from 1,418,620 bytes to just 168,998 bytes.
    EWWW
    Code (Text):
    image : pexels-photo-434164-2.jpeg : 2048 : 1365 : 82 : False : 8 : 322571 : nginx : nginx
    image : pexels-photo-434164-2.jpeg.webp : 2048 : 1365 : 92 : False : 8 : 176632 : nginx : nginx
    
    image : pexels-photo-434164.jpeg : 7768 : 5178 : 94 : False : 8 : 6809611 : nginx : nginx
    image : pexels-photo-434164.jpeg.webp : 7768 : 5178 : 92 : False : 8 : 1418620 : nginx : nginx
    

    optimise-images.sh
    Code (Text):
    image : pexels-photo-434164-2.jpeg : 2048 : 1365 : 82 : False : 8 : 322053 : nginx : nginx
    image : pexels-photo-434164-2.jpeg.webp : 2048 : 1365 : 92 : False : 8 : 167744 : root : nginx
    
    image : pexels-photo-434164.jpeg : 2048 : 1365 : 82 : False : 8 : 324373 : nginx : nginx
    image : pexels-photo-434164.jpeg.webp : 2048 : 1365 : 92 : False : 8 : 168998 : root : nginx
    

    So looks like combining EWWW Image Optimizer + Imsanity to automate initial optimisation and resizing for Wordpress user uploaded images first and then running the Wordpress upload directory through optimise-images.sh (i.e. cronjob) may work to
    1. dramatically reduce on disk Wordpress uploaded image size and
    2. reduce front end Wordpress page load times due to image sizes (if Nginx WebP is enabled).
    Always backup your Wordpress site data and files first if you are planning to try out also using optimise-images.sh in this manner and if you want to use optimise-image.sh for WebP conversion, probably easier to turn off WebP conversion in EWWW Image Optimizer and let optimise-images.sh do the conversion :)
     
    Last edited: Dec 12, 2019
  6. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+

    EWWW Image Optimizer VS optimise-images.sh Part 2



    Part 2 compare this time using all the sample images located here as uploaded Wordpress media library images and instead of running EWWW Image Optimizer first, I ran optimise-images.sh directly on default uploaded images. Much closer numbers for resized 2048x2048 max limited runs (so only images >2048 would be resized). No WebP conversion was made in EWWW or optimise-images.sh this time.

    ewww-vs-optimise-images-200817-01.png

    Default Wordpress 4.8.1 uploaded media size and count ~217 MB in size and 361 images in upload directory at /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    Code (Text):
    du -s /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    268032  /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    

    Code (Text):
    ls /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/ | wc -l
    361
    

    I will use optimise-images.sh profile command to summarize the state of before and after optimisation sizes.

    The command
    Code (Text):
    ./optimise-images.sh profile /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    


    For Wordpress 4.8.1 default optimise-images.sh profile
    Code (Text):
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 897       | 634        | 87          | 758285     | 273740966          | 267325          |
    


    EWWWW Image Optimizer optimised with no resize + no webp + lossless (only option in free plugin)

    Code (Text):
    du -s /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    248812  /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    

    Code (Text):
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 897       | 634        | 87          | 703773     | 254061889          | 248107          |
    


    EWWWW Image Optimizer optimised with resize max 2048 + no webp + lossless (only option in free plugin)

    Code (Text):
    du -s /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    76824   /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    

    Code (Text):
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 692       | 488        | 87          | 215918     | 77946573           | 76120           |
    


    WP 4.8.1 default + optimise-images.sh default 2048x2048 max resize IMAGICK_RESIZE='y'

    Code (Text):
    du -s /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    71920   /home/nginx/domains/domain.com/public/wp-content/uploads/2017/08/
    

    Code (Text):
    ------------------------------------------------------------------------------
    | Avg width | Avg height | Avg quality | Avg size   | Total size (Bytes) | Total size (KB) |
    | --------- | ---------- | ----------- | --------   | ------------------ | --------------- |
    | 691       | 486        | 86          | 202004     | 72923388           | 71214           |
    
     
    Last edited: Aug 20, 2017
  7. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    hello nice tutorial
    is there any comparison to shortpixel.com?
     
  8. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    I think
    location /wp-content/uploads/

    is better than

    location /wp-content/uploads/2017


    so that it is future proof?
     
  9. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    also, I had this error:

    Code:
    Nov 04 05:03:21 test-instance nginx[30888]: Starting nginx: nginx: [emerg] "map" directive is not allowed here in /usr/local/nginx/conf/webp.conf:1
    
    i have:
    Code:
    map $http_accept $webp_extension {
       default "";
       "~*webp" ".webp";
    }
    
     
  10. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    none unfortunately
    script only works 1 level deep and not for subdirectories so will need a few location matches see GitHub - centminmod/optimise-images: Batch image resizer, optimiser and profiler using ImageMagick convert, OptiPNG, JpegOptim and optional ZopfliPNG, Guetzli and MozJPEG.
    centmin mod 123.08stable or 123.09beta01 nginx ? what's output for
    Code (Text):
    nginx -V
    

    and contents for
    Code (Text):
    /usr/local/nginx/conf/nginx.conf
    
     
  11. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    i had this error

    Starting nginx: nginx: [emerg] unknown "webp_extension" variable


    Code:
    nginx version: nginx/1.13.6
    built by gcc 6.3.1 20170216 (Red Hat 6.3.1-3) (GCC)
    built with LibreSSL 2.5.5
    TLS SNI support enabled
    configure arguments: --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib' --with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3 -Wno-error=strict-aliasing -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -gsplit-dwarf' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-compat --with-http_stub_status_module --with-http_secure_link_module --with-libatomic --with-http_gzip_static_module --add-dynamic-module=../ngx_brotli --with-http_sub_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --with-stream=dynamic --with-stream_ssl_module --with-http_realip_module --add-dynamic-module=../ngx-fancyindex-0.4.2 --add-module=../ngx_cache_purge-2.4.2 --add-module=../ngx_devel_kit-0.3.0 --add-dynamic-module=../set-misc-nginx-module-0.31 --add-dynamic-module=../echo-nginx-module-0.61 --add-module=../redis2-nginx-module-0.14 --add-module=../ngx_http_redis-0.3.7 --add-module=../memc-nginx-module-0.18 --add-module=../srcache-nginx-module-0.31 --add-dynamic-module=../headers-more-nginx-module-0.32 --with-pcre=../pcre-8.41 --with-pcre-jit --with-zlib=../zlib-1.2.11 --with-http_ssl_module --with-http_v2_module --with-openssl=../libressl-2.5.5
    
     
  12. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    you should have only one referenced entry to webp.conf include file within http{} context of /usr/local/nginx/conf/nginx.conf
    Code (Text):
    include /usr/local/nginx/conf/webp.conf;
    

    and /usr/local/nginx/conf/webp.conf should contain
    Code (Text):
    map $http_accept $webp_extension {
        default "";
        "~*webp" ".webp";
    }
    

    use grep with context of 3 lines to check
    Code (Text):
    grep -C3 webp /usr/local/nginx/conf/nginx.conf
    

    output example
    Code (Text):
    grep -C3 webp /usr/local/nginx/conf/nginx.conf
    include /usr/local/nginx/conf/maintenance.conf;
    #include /usr/local/nginx/conf/vts_http.conf;
    include /usr/local/nginx/conf/geoip.conf;
    include /usr/local/nginx/conf/webp.conf;
    #include /usr/local/nginx/conf/pagespeedadmin.conf;
    include /usr/local/nginx/conf/fastcgi_param_https_map.conf;
    
     
  13. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    I did, but shows
    Code:
    Nov 04 05:23:56 test-instance nginx[2350]: Starting nginx: nginx: [emerg] "map_hash_bucket_size" directive is duplicate in /usr/local/nginx/conf/nginx.conf:27
    
    
     
  14. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    Code:
    user              nginx nginx;
    worker_processes 4;
    worker_priority -10;
    
    worker_rlimit_nofile 260000;
    timer_resolution 100ms;
    
    pcre_jit on;
    include /usr/local/nginx/conf/dynamic-modules.conf;
    
    
    pid         logs/nginx.pid;
    
    events {
       worker_connections  50000;
       accept_mutex off;
       accept_mutex_delay 200ms;
       use epoll;
       #multi_accept on;
    }
    
    http {
    limit_req_zone $binary_remote_addr zone=xwprpc:10m rate=30r/s;
    
     include /usr/local/nginx/conf/webp.conf;
     include /usr/local/nginx/conf/brotli_inc.conf;
     map_hash_bucket_size 128;
     map_hash_max_size 4096;
    
     server_names_hash_bucket_size 128;
     server_names_hash_max_size 2048;
     variables_hash_max_size 2048;
    
    limit_req_zone $binary_remote_addr zone=xwplogin:16m rate=40r/m;
    #limit_conn_zone $binary_remote_addr zone=xwpconlimit:16m;
    more_set_headers "Server: nginx";
    
    # uncomment cloudflare.conf include if using clou
    
    is the file contents
     
  15. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    contents of /usr/local/nginx/conf/nginx.conf ?
    Code (Text):
    cat /usr/local/nginx/conf/nginx.conf
    
     
  16. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
  17. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  18. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    I dont know why this happend??? I dont touch that

    I will put the default
     
  19. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    12:18 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    well 123.08stable has different nginx.conf defaults than 123.09beta01 so that could be it ?
     
  20. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    4:18 AM
    I restored the backup, anyhow I only changed the TLS to
    libressl (on general config modifier?

    I will chek later