Last active
February 20, 2018 09:32
-
-
Save jiri001meitner/2947b63c01b96c35e66f6a974e473037 to your computer and use it in GitHub Desktop.
optimages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
optidir="$*" | |
fronta="$(mktemp)" | |
find "${optidir}/" -type f -iname *.jpg -exec du -a {} + | sort -n -r | cut -f 2 >"$fronta" | |
while read line | |
do | |
printf "%s\n" "$line" | |
jpeg-recompress -q medium -l 128 -a -c -m smallfry "$(printf "%s\n" "$line")" "$(printf "%s\n" "$line")" | |
done <"$fronta" | |
rm "$fronta" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://guides.wp-bullet.com/batch-optimize-jpg-lossy-linux-command-line-with-jpeg-recompress/
https://guides.wp-bullet.com/batch-optimize-jpg-lossy-linux-command-line-with-jpeg-recompress/
sudo apt-get install build-essential autoconf pkg-config nasm libtool
git clone https://github.com/mozilla/mozjpeg.git
cd mozjpeg
autoreconf -fiv
./configure --with-jpeg8
make
sudo make install
apt install nodejs optipng
npm install -g svgo