直接创建个sh的脚本就行,注意看注释!
#!/bin/bash # 你需要确保 cwebp 工具已经安装。如果还没有安装,可以通过 Homebrew 安装:brew install webp # 这里修改为自己的路径 cd /Users/imacos.top/Downloads/png # 处理所有 .png, .jpg, .jpegT .IFF 文件 for file in *.{png,jpg,jpeg,TIFF}; do if [[ -f "$file" ]]; then # 确保是文件而不是目录 # 使用 cwebp 将图片转换为 webp 格式 cwebp "$file" -o "${file%.*}.webp" echo "已转换: $file -> ${file%.*}.webp" fi done echo "转换完成!"
原文链接:https://imacos.top/2025/01/01/1545/,转载请注明出处。
评论0