Skip to content

Instantly share code, notes, and snippets.

@acharlieh
Created December 23, 2017 23:53
Show Gist options
  • Save acharlieh/653aac30b1e819f5378ba5d0987c22a6 to your computer and use it in GitHub Desktop.
Save acharlieh/653aac30b1e819f5378ba5d0987c22a6 to your computer and use it in GitHub Desktop.
Useful Aliases
alias jpgoptim='find . -iname '"'"'*.jpg'"'"' -exec convert {} -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB {}.new \; -exec bash -c "ls -l {} {}.new | awk '"'"'/\.jpg\$/ {old=\$5;oldf=\$9} /\.jpg\.new\$/ {new=\$5;newf=\$9} END { if(old<=new) print \"rm \" newf; else print \"mv \" newf \" \" oldf }'"'"' " \; | bash -x'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment