Skip to content

Instantly share code, notes, and snippets.

@HarshadRanganathan
Created May 10, 2020 17:52
Show Gist options
  • Save HarshadRanganathan/4b02b21a7e3dc3a62a876bfca3c681a7 to your computer and use it in GitHub Desktop.
Save HarshadRanganathan/4b02b21a7e3dc3a62a876bfca3c681a7 to your computer and use it in GitHub Desktop.
Lighthouse Tools
// convert all files to webp format with quality ratio of 80
for file in img/*; do cwebp -q 80 "$file" -o "${file%.*}.webp"; done
// convert images based on google's recommended sampling factor, quality and interlace
magick mogrify -sampling-factor 4:2:0 -strip -quality 75 -interlace JPEG -colorspace RGB -format jpg *.png
magick mogrify -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB *.jpg
@pwuckpwuck
Copy link

Hi HarshadRanganathan,
I have no idea what I'm doing. I need to convert .jpg files to .webp using by -zsh in Terminal on a Mac laptop. This is what I entered in Terminal ////Downloads/TestImage/Test2.jpg; do cwebp -q 80 "test2.jpg" -o "${test2%.*}.webp"; done////
zsh returns this error ////zsh: parse error near 'do'////
I know nothing about programming. Any advice? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment