Batch-Resize a Folder of Photos with sips
Shrink every JPG in a folder to a maximum side length with a one-line shell loop using built-in sips.
Run for f in ~/Desktop/Photos/*.jpg; do sips -Z 1200 "$f"; done so no photo exceeds 1200 px on its longest side.
01Command
Command
$ for f in ~/Desktop/Photos/*.jpg; do sips -Z 1200 "$f"; done02What it does
sips -Z keeps the aspect ratio and caps the longest side at the given pixel count — perfect for email-sized copies. The loop feeds every *.jpg in the folder to sips, and you can widen the glob (or use find) for other formats and subfolders. This is the quick, no-app way to prepare photos for email, forums or a website upload.
03Risk
!Warning: sips rewrites the files in place; keep the originals by copying the folder first, and note PNG/HEIC files need their own glob since the loop only matches *.jpg.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- sips - Scriptable Image Processing SystemEvidence: Documents the -Z resampleHeightWidthMax option which resizes an image so its longest side matches the given pixel count.
- sips(1) man pageEvidence: The sips man page describes the resample properties (-Z resampleHeightWidthMax) used to change image dimensions in place.
Last verified: 2026-09-19 · Category: Media