Skip to content

Instantly share code, notes, and snippets.

@inlikealion
Created October 22, 2020 12:14
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 inlikealion/14a8c224e4c889879581e822661c0742 to your computer and use it in GitHub Desktop.
Save inlikealion/14a8c224e4c889879581e822661c0742 to your computer and use it in GitHub Desktop.
sh one-liners for batch-conversion of images to webp via cwebp
# One-liners:
# See: https://www.smashingmagazine.com/2018/07/converting-images-to-webp/
## JPG
find ./ -type f -name '*.jpg' -exec sh -c 'cwebp -q 80 $1 -o "${1%.jpg}.webp"' _ {} \;
## PNG
find ./ -type f -name '*.png' -exec sh -c 'cwebp -q 80 $1 -o "${1%.png}.webp"' _ {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment