用 sips 循环批量缩小整个文件夹的照片

200 张照片全是 4000 像素宽?一行 shell 循环配合自带 sips 全部缩小。

macOS批处理图片sips 图片处理低风险
运行 for f in ~/Desktop/Photos/*.jpg; do sips -Z 1200 "$f"; done,所有照片最长边不超过 1200 像素。

01命令

命令
$ for f in ~/Desktop/Photos/*.jpg; do sips -Z 1200 "$f"; done

02作用说明

sips -Z 保持宽高比并把最长边限制在指定像素数——正适合生成邮件尺寸的副本。循环把文件夹里每个 *.jpg 喂给 sips,改一下通配符(或用 find)也能处理其他格式和子文件夹。这是不用任何 App、快速准备照片发邮件或上传网站的方法。

03风险

风险低风险
使用条件sips overwrites each file in place — copy the folder first if you want to keep the originals.
!注意: sips 会直接覆盖原文件;想保留原图请先复制文件夹。PNG/HEIC 需要单独的通配符,因为循环只匹配 *.jpg。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • sips - Scriptable Image Processing System
    SS64 · technical · 2026-09-17
    依据: Documents the -Z resampleHeightWidthMax option which resizes an image so its longest side matches the given pixel count.
  • sips(1) man page
    manpagez.com · technical · 2026-09-17
    依据: The sips man page describes the resample properties (-Z resampleHeightWidthMax) used to change image dimensions in place.

最后验证: 2026-09-19 · 分类: 媒体

06相关方案