Skip to content

Instantly share code, notes, and snippets.

@AndresReyesDev
Forked from w33zy/jpg-png-optimize.md
Created March 4, 2020 03:56
Show Gist options
  • Save AndresReyesDev/f4967863b5c8374543c1391d99bc66b7 to your computer and use it in GitHub Desktop.
Save AndresReyesDev/f4967863b5c8374543c1391d99bc66b7 to your computer and use it in GitHub Desktop.
Optimize your jpg & png images with jpegoptim and optipng on linux

JPG and PNG image bulk optimization

Install jpegoptim and optipng

apt update && apt install jpegoptim optipng -y

JPG optimization

cd /path/to/your/image/folder
find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --strip-all -m76

PNG optimization

cd /path/to/your/image/folder
find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment