软件在 appinn 看到, 真是好用, 救了小弟一命.
成功把 1.6GB 的媒体库, 压缩到 400MB+
Squoosh-CLI
Squoosh-CLI(https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) 是 Squoosh 的命令行版本,需要先在电脑上安装 Node.js,然后再安装 Squoosh-CLI:
下载并安装 Node.js:https://nodejs.org/zh-cn/
安装 Squoosh-CLI:npm i -g @squoosh/cli (需要再终端,或者命令提示符中使用)
命令:
squoosh-cli --mozjpeg auto ./ -d ./output
上述的意思是使用 MozJPEG 的自动优化功能来压缩图片,并转换为 jpg 格式.
然后就会在原文件夹的 output 目录里,获得压缩后的 jpg 文件了。去掉 -d 参数会保存压缩后的文件至原目录。
小弟使用:
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}' ./
相关URL:
https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli
https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.ts