Skip to content

Instantly share code, notes, and snippets.

@JayHoltslander
Last active June 9, 2020 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayHoltslander/05cab870ef701e909f0ff2a5f68bb6d6 to your computer and use it in GitHub Desktop.
Save JayHoltslander/05cab870ef701e909f0ff2a5f68bb6d6 to your computer and use it in GitHub Desktop.
Batch convert images in current folder to webp format using Google's cwebp tool.
# cwebp Docs: https://developers.google.com/speed/webp/docs/using
find ./ -type f -name '*.png' -exec sh -c 'cwebp -q 75 $1 -o "${1%.png}.webp"' _ {} \; &&
find ./ -type f -name '*.jpg' -exec sh -c 'cwebp -q 75 $1 -o "${1%.jpg}.webp"' _ {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment