Squoosh CLI


Another thing I picked up from Simon Willison, the squoosh app is a great tool for compressing images. I’ve been using the UI and I only just realised that there’s a CLI version available too. Even better, you can copy config from the UI and paste it into your terminal in a couple of clicks.

Here’s the last config that I used - I didn’t notice any discernible quality difference!

npx @squoosh/cli --webp '{"quality":54.9,"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":1,"image_hint":0,"emulate_jpeg_size":0,"thread_level":0,"low_memory":0,"near_lossless":100,"use_delta_palette":0,"use_sharp_yuv":0}' <path_to_file>

Great for those by-hand optimised images (although it does make me appreciate Next a lot…) Try it out!

© neverstew 2022
GitHub logo