Skip to content

Instantly share code, notes, and snippets.

@JoelLisenby
Last active April 5, 2018 16:22
Show Gist options
  • Save JoelLisenby/0f51dd8e5797e5cfaf53bfcc9e76d605 to your computer and use it in GitHub Desktop.
Save JoelLisenby/0f51dd8e5797e5cfaf53bfcc9e76d605 to your computer and use it in GitHub Desktop.
Optimize all jpg and png images in current directory and sub-directories recursively with imagemagick mogrify to google pagespeed spec.
#!/bin/sh
find . -name '*.jpg' -execdir mogrify -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB -format jpg {} \;
find . -name '*.png' -execdir mogrify -strip {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment