Optimize images via Squoosh
- optimize jpg
- optimize png
- optimize svg
- convert bmp to jpg
- convert jpg, png to webp + avif
- check for avoid double optimization
for running need installed node.js + sharp (https://www.npmjs.com/package/sharp)
First of first, need install NODE.JS
sudo curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
sudo apt-get install -y nodejs
git clone https://github.com/tweenpix/imgoptimizer.git
chmod +x /path/to/imgoptimize.js ln -s /path/to/imgoptimize.js /usr/local/bin/imgoptimize
const logFile = "/var/log/optimization.log";
const iUser = 'webuser';
const iGroup = 'webuser';
run from parrent image directory for recursivly optimization
as
find . -type d ( ! -name . ) -exec bash -c "cd '{}' && imgoptimize" ;
just run: imgoptimize clean