Using optimise-images.sh with new profile-age
and optimise-age
and optimise-cron-age
modes to filter image processing by age via FIND_IMGAGE
variable which takes value in minutes. If set variable to FIND_IMGAGE='1440'
, the script will only check and process images newer / created within the past 1440 minutes
or 1 day
. The optimise-cron-age
mode is for use as a cronjob schedule as it removes the post-optimisation profile routine run to save time.
Usage:
./optimise-images.sh
./optimise-images.sh {optimise} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {optimise-age} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {optimise-cron} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {optimise-cron-age} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {optimise-webp} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {optimise-webp-nginx} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {profile} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {profile-age} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {profilelog} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {testfiles} /PATH/TO/DIRECTORY/WITH/IMAGES
./optimise-images.sh {install}
./optimise-images.sh {bench}
./optimise-images.sh {bench-compare}
./optimise-images.sh {bench-webp}
./optimise-images.sh {bench-webpcompare}
./optimise-images.sh {bench} all
./optimise-images.sh {bench-compare} all
./optimise-images.sh {bench-webp} all
./optimise-images.sh {bench-webpcompare} all
profile-age
run with FIND_IMGAGE='60'
for images created wihtin the past 60 minutes at /home/optimise-benchmarks
./optimise-images.sh profile-age /home/optimise-benchmarks
------------------------------------------------------------------------------
image profile filtered: 60 minutes old
image name : width : height : quality : transparency : image depth (bits) : size : user: group
------------------------------------------------------------------------------
images in /home/optimise-benchmarks
logged at /home/optimise-logs/profile-log-170817-024839.log
------------------------------------------------------------------------------
image : bees.png : 444 : 258 : 92 : False : 8 : 175275 : root : root
image : dslr_canon_eos_m6_1.jpg : 1200 : 800 : 82 : False : 8 : 160946 : root : root
image : dslr_nikon_d7200_1.jpg : 2048 : 1365 : 82 : False : 8 : 374452 : root : root
image : dslr_nikon_d7200_2.jpg : 1365 : 2048 : 82 : False : 8 : 516097 : root : root
image : png24-image1.png : 600 : 400 : 92 : False : 8 : 386063 : root : root
image : png24-interlaced-image1.png : 600 : 400 : 92 : False : 8 : 443931 : root : root
image : samsung_s7_mobile_1.jpg : 2048 : 1536 : 82 : False : 8 : 256349 : root : root
image : webp-study-source-firebreathing.png : 1024 : 752 : 92 : False : 8 : 1194070 : root : root
------------------------------------------------------------------------------
Original or Existing Images:
------------------------------------------------------------------------------
| Avg width | Avg height | Avg quality | Avg size | Total size (Bytes) | Total size (KB) |
| --------- | ---------- | ----------- | -------- | ------------------ | --------------- |
| 1166 | 945 | 87 | 438398 | 3507183 | 3425 |
------------------------------------------------------------------------------
ImageMagick Resource Limits
------------------------------------------------------------------------------
Version: ImageMagick 6.9.9-6 Q16 x86_64 2017-08-11
Resource limits:
Width: 214.7MP
Height: 214.7MP
Area: 67.057GP
Memory: 31.226GiB
Map: 62.452GiB
Disk: unlimited
File: 196608
Thread: 4
Throttle: 0
Time: unlimited
------------------------------------------------------------------------------
Completion Time: 0.13 seconds
------------------------------------------------------------------------------
Optimise for images at /home/optimise-benchmarks
/root/tools/optimise-images/optimise-images.sh optimise-age /home/optimise-benchmarks
You would need to use normal profile
mode instead of profile-age
right after optimise-age
runs as the new optimised images will have a newer timestamp age preventing profiling to return any images right after optimise-age
run
./optimise-images.sh profile /home/optimise-benchmarks
------------------------------------------------------------------------------
image profile
image name : width : height : quality : transparency : image depth (bits) : size : user: group
------------------------------------------------------------------------------
images in /home/optimise-benchmarks
logged at /home/optimise-logs/profile-log-170817-031053.log
------------------------------------------------------------------------------
image : bees.png : 444 : 258 : 92 : False : 8 : 175275 : root : root
image : dslr_canon_eos_m6_1.jpg : 1200 : 800 : 82 : False : 8 : 160976 : root : root
image : dslr_nikon_d7200_1.jpg : 2048 : 1365 : 82 : False : 8 : 374463 : root : root
image : dslr_nikon_d7200_2.jpg : 1365 : 2048 : 82 : False : 8 : 516101 : root : root
image : png24-image1.png : 600 : 400 : 92 : False : 8 : 386063 : root : root
image : png24-interlaced-image1.png : 600 : 400 : 92 : False : 8 : 443931 : root : root
image : samsung_s7_mobile_1.jpg : 2048 : 1536 : 82 : False : 8 : 256357 : root : root
image : webp-study-source-firebreathing.png : 1024 : 752 : 92 : False : 8 : 1194070 : root : root
------------------------------------------------------------------------------
Original or Existing Images:
------------------------------------------------------------------------------
| Avg width | Avg height | Avg quality | Avg size | Total size (Bytes) | Total size (KB) |
| --------- | ---------- | ----------- | -------- | ------------------ | --------------- |
| 1166 | 945 | 87 | 438404 | 3507236 | 3425 |
------------------------------------------------------------------------------
ImageMagick Resource Limits
------------------------------------------------------------------------------
Version: ImageMagick 6.9.9-6 Q16 x86_64 2017-08-11
Resource limits:
Width: 214.7MP
Height: 214.7MP
Area: 67.057GP
Memory: 31.226GiB
Map: 62.452GiB
Disk: unlimited
File: 196608
Thread: 4
Throttle: 0
Time: unlimited
------------------------------------------------------------------------------
Completion Time: 0.13 seconds
------------------------------------------------------------------------------