Skip to content

Instantly share code, notes, and snippets.

@StefMa
Last active August 30, 2016 07:51
Show Gist options
  • Save StefMa/7a4e4ce396d7a9f10524c8567636fa21 to your computer and use it in GitHub Desktop.
Save StefMa/7a4e4ce396d7a9f10524c8567636fa21 to your computer and use it in GitHub Desktop.
Simple PNG/JPG to WebP converter
images=($(find . -iname '*.png' -o -iname '*.jpg'))
for image in "${images[@]}"; do
webp_file_path="${image::${#image}-4}.webp"
echo "Convert ${image} to ${webp_file_path}"
$(./cwebp-5.1 -quiet "${image}" -o "${webp_file_path}")
rm "${image}"
done
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment