Skip to content

Instantly share code, notes, and snippets.

@bryanmylee
Created June 5, 2022 08:29
Show Gist options
  • Save bryanmylee/ec13cf8057c74a30ac14b182d02c04a5 to your computer and use it in GitHub Desktop.
Save bryanmylee/ec13cf8057c74a30ac14b182d02c04a5 to your computer and use it in GitHub Desktop.
Batch compress images with Squoosh
find $1 -name "*.jpg" -exec bash -c $'file="{}"; npx @squoosh/cli --webp \'{"quality":75,"target_size":0,"target_PSNR":0,"method":4,"sns_strength":50,"filter_strength":60,"filter_sharpness":0,"filter_type":1,"partitions":0,"segments":4,"pass":1,"show_compressed":0,"preprocessing":0,"autofilter":0,"partition_limit":0,"alpha_compression":1,"alpha_filtering":1,"alpha_quality":100,"lossless":0,"exact":0,"image_hint":0,"emulate_jpeg_size":0,"thread_level":0,"low_memory":0,"near_lossless":100,"use_delta_palette":0,"use_sharp_yuv":0}\' -d ./output/ "$file"' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment