Skip to content

Instantly share code, notes, and snippets.

@w33zy
Forked from VirtuBox/jpg-png-optimize.md
Created January 4, 2018 20:39
Show Gist options
  • Save w33zy/7b948d10175f5417af60ce0128e1e1bd to your computer and use it in GitHub Desktop.
Save w33zy/7b948d10175f5417af60ce0128e1e1bd 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