Skip to content

Instantly share code, notes, and snippets.

@MadMikeyB
Last active June 30, 2021 09:11
Show Gist options
  • Save MadMikeyB/84d84136552710522f4851a0c92efc8e to your computer and use it in GitHub Desktop.
Save MadMikeyB/84d84136552710522f4851a0c92efc8e to your computer and use it in GitHub Desktop.
Install Image Optimiser Scripts
curl -s https://gist.githubusercontent.com/MadMikeyB/84d84136552710522f4851a0c92efc8e/raw/dd61c5b433d2a5952edae97a01b02d4b68a30939/install-image-optimizers.sh > install-image-optimizers.sh && bash install-image-optimizers.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
echo "Installing jpegoptim"
apt-get -y install jpegoptim
echo "Installing optipng"
apt-get -y install optipng
echo "Installing svgo"
npm install -g svgo
echo "Installing gifsicle"
apt-get -y install gifsicle
echo "Installing webp"
apt-get -y install webp
echo "Installing Dependencies for mozjpeg"
apt-get -y install cmake autoconf automake libtool nasm make pkg-config git
echo "Changing Directory to ~"
cd ~
echo "Cloning mozjpeg"
git clone https://github.com/mozilla/mozjpeg.git
cd mozjpeg
echo "Building mozjpeg"
mkdir build && cd build
cmake -G"Unix Makefiles" ../
make install
echo "Creating mozjpeg symlink"
ln -s /opt/mozjpeg/bin/jpegtran /usr/bin/mozjpeg
echo "ALL DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment