Batch Resize a Group of Pictures from the Command Line with sips
Though most Mac users will likely prefer to use Preview to batch resize images because of the ease of use, advanced users often like to go with the command line for repetitive tasks. We’ve discussed sips before as a way to resize, rotate, and flip images, but if sips is combined with wildcards it can also function as a quick way to batch resize a group of photos.
How to Batch Resize Photos with sips at Command Line
Launch Terminal from the /Application/Utilities/ folder and use the following syntax:
sips -Z (max height in pixels) /path/to/images/*.(image file extension)
For example, to resize a collection of jpg pictures to each have a max height of 620, located in the desktop folder “ResizeMe”:
sips -Z 620 ~/Desktop/ResizeMe/*.jpg
The -Z flag instructs sips to retain the images original aspect ratio while maintaining a maximum height of 620, but you can also specify exact height and width by using a lowercase -z flag instead like so:
sips -z 620 840 *.jpg
The height in pixels is first, followed by the width in pixels.
If the command line doesn’t fit well into a workflow, another great option is to batch resize images with an Automator script, which has the added benefit of becoming a self-contained application allowing for standard Finder interactions like drag and drop.
This handy reminder about sips comes to us from Lifehacker
Hi, I discover SIPS and try to make an automation in automator with it but can’t figure how since it seem to process only one image at a time.
Here is my topic on Apple discussions to : https://discussions.apple.com/message/33433858#33433858
You can batch resize images in Preview:
Or you can use Automator to create a batch file image resizer that is automated, like you describe:
Sips is possible too, but is command line based, and unnecessary if you use the above approaches.
Another possible solution is to use Gimp, an excellent free software.
sips (and Preview and Automator) make images fairly blurry though. ImageMagick allows choosing from different interpolation filters and adding sharpening manually. It also has more resizing and cropping options.
This would make images 50% smaller and convert them to JPG:
mogrify -filter lanczos2 -resize 50% -format jpg -quality 92 -path ~/Desktop/ *.png
Thanks! Great help!
Maybe you can feature more Automator tips and tricks.
That app has a lot of potential but is not covered much.
I’ve been using SIPS for goodness knows how long. I like adding a little spotlight love to it so I can recursively hunt down images that are larger than my target size.
mdfind -0 -onlyin . “kMDItemPixelHeight > 620 || kMDItemPixelWidth > 620” | xargs -0 sips -Z 620
Good tip, but I would add another step that is making a copy of the pictures that you want to resize. That way you can still have the original dimension pictures available too.