How to Use macOS SIPS to Batch Resize Images

There are many ways to resize images. On Mac, SIPS is an especially good option for working with large batches of images. It’s a free command-line tool that’s baked into macOS.

Text & Photos By David Coleman
Last Revised & Updated:

I MAY get commissions for purchases made through links in this post.

Macs come with some very useful image editing tools built-in. Some are obvious, like the default image viewer Preview or the Photos app.

But there are some also less obvious but powerful tools that are especially useful for repeating common tasks or working with large batches of image files. Automator is a good example.

The one I’m focusing on here is called SIPS, and it often flies well under the radar. For a long time, I didn’t even know it was there. But since discovering it, I’ve found it to be a very useful addition to my photography and web workflows.

While I have a bunch of image editing apps on my Mac, sometimes it can be quicker, easier, and cleaner to use a tool like this, especially when working with a lot of images at once.

What is SIPS?

SIPS stands for (Scriptable Image Processing System). It’s a command-line tool that you use through Terminal. And while it doesn’t come with a graphical user interface, with some basic commands, you can get some common image tasks done quickly and efficiently.

Even better: it doesn’t require downloading or installing an app. If you use a Mac, it’s already there, baked directly into macOS.

I’m putting together some step-by-step guides to using SIPS for common image tasks that photographers run into. The task I’m focusing on here is resizing images, especially large batches of them.

Worth knowing: These are for resizing images. They are not for cropping images.

NB: The first few basic examples overwrite the input file, so make sure to be using them on copies, not the original files. There’s information on how to create new copies in the output below.

Open Terminal

  1. Open the Terminal application (you can find it in Applications > Utilities or search for it using Spotlight with Command + Space). Or you can navigate to the folder with the images in Finder, then Right-click (or CTRL-click) on the folder containing the images in Finder. Choose Services > New Terminal at Folder.

How to Resize Individual Images Using SIPS

To keep things simple, I’ll start with the core commands on individual images.

Long Edge Maximum Pixel Dimensions

This is the most basic command. It essentially reduces the longest edge to whatever value you’ve used instead of maxPixels.

It maintains the aspect ratio, and it’s especially useful if you have a mix of portrait and landscape orientation images (horizontal and vertical) but want to set the long edge on all of them. Replace imagefile.jpg with the path to your image.

NB: As is, this will overwrite every file with the new version, so make sure you’re working with copies. I have an example for saving new files to a separate output subfolder in the batch processing section below.

sips -Z maxPixels imagefile.jpg

Replace: maxPixels with whatever value you want for the long edge pixel dimension (eg. 1024).

Replace: imagefile.jpg with the name of your image.

As a practical example, here’s what I’d use if I want to process every JPG image in a folder to a long edge of 2400 pixels.

sips -Z 2400 *.jpg 

Set Width or Height Explicitly (While Preserving Aspect Ratio)

These can be useful if you want to specify dimensions in one direction, maybe for laying out photos in a grid. It works best for images that are all the same orientation (eg. all portrait or all landscape).

If you only want to set the width and maintain the aspect ratio, you can use:

sips --resampleWidth pixelsWidth imagefile.jpg

Replace: pixelsWidth with the desired width. The height will be adjusted automatically to maintain the aspect ratio.

Replace: imagefile.jpg with the name of your image.

If you only want to set the height and maintain the aspect ratio, you can use:

sips --resampleHeight pixelsHeight imagefile.jpg

Replace: pixelsHeight with the desired height.

Replace: imagefile.jpg with the name of your image.

Set Width & Height Explicitly (Without Maintaining Aspect Ratio)

This gives you direct control over the width and height, but it comes at the cost of preserving the aspect ratio. Unless you choose dimensions that happen to match the previous aspect ratio, you’re going to end up with a squished image. For that reason, it’s not an especially useful function when working with photos.

sips --resampleWidthWidth pixelsWidth --resampleHeight pixelsHeight imagefile.jpg

Replace: pixelsWidth and pixelsHeight with the desired width and height in pixels

How to Output Resized Image as a New File

If you want to save the resized image as a new file, add --out newimagefile.jpg at the end of the command, replacing newimagefile.jpg with the desired new file name.

How to Batch Resize Images

You can also use sips to batch resize images by using a wildcard (*) or by scripting a loop to process multiple files. I used the most basic version of that in the first example above, but the big shortcoming of that version is that it overwrites the input files. And it’s worth saying: there’s no undo if you do this.

It’s safer practice to instead create new files and put the new output files in their own folder. That preserves the original files in case you want to run the process again.

Here’s an example of resizing all JPEG images in a folder to a width of 1024 pixels and then saving the output as new files in a separate subfolder:

for file in *.jpg; do sips --resampleWidth 1024 "$file" --out "Resized/${file}"; done

This will process all .jpg files in the current directory, resizing them to a width of 1024 pixels and saving them in the Resized directory with the same filenames. (NB: Make sure you create the Resized folder before running this command; it won’t create the folder itself.)

Remember to replace 1024 with the width you want, and adjust the file extension if you’re working with .png or another file type.

How to Process Folders Recursively

If you’re dealing with a nested folder structure containing images in various subfolders, you can use SIPS to recursively process and resize these images.

The trick is to combine it with the find command, which can traverse directory trees to apply actions to files that match certain criteria.

Here’s how to do it:

Resize Images Recursively

To resize all JPEG images in the current directory and all subdirectories to a width of 1024 pixels, you can use the following command (NB: This basic version overwrites the input files, so use with caution.)

find . -iname '*.jpg' -exec sips --resampleWidth 1024 {} \;

Here’s what each part of the command does:

  • find . – starts the search in the current directory.
  • -iname '*.jpg' – looks for files with the .jpg extension, case-insensitively.
  • -exec – executes a command on each file found.
  • sips --resampleWidth 1024 {} – runs sips to resize the width to 1024 pixels. The {} is a placeholder for each file found.
  • \; – signifies the end of the command.
Save Resized Images to a New Location

To save the resized images to a new location, preserving the directory structure, things get more complicated, and you’ll need to incorporate a bit more shell scripting.

Here’s an example:

find . -iname '*.jpg' -type f | while read file; do
    mkdir -p "$(dirname "$newpath")"
    sips --resampleWidth 1024 "$file" --out "$newpath"

This can be input directly into the Terminal window or saved as a shell script for reuse later.

Remember to create the Resized base directory before running the script if it doesn’t already exist.

If you’d like a more verbose version that explains in more detail what it has done with each file:

find . -iname '*.jpg' -type f | while read file; do
    echo "Processing $file..."
    echo "New path: $newpath"
    mkdir -p "$(dirname "$newpath")" && echo "Created directory: $(dirname "$newpath")"
    sips --resampleWidth 1024 "$file" --out "$newpath" && echo "Resized image saved to $newpath"

Things Worth Knowing

  • SIPS is quite efficient at working with large batches of image files, and I routinely apply it to thousands of images at once. But if you’re running into issues or working with an especially large number of files, it can be useful to break them up into batches by using a few image folders instead of a single folder.

Terminal Basics: Navigating to the Image Folder

This isn’t the place for dealing with the ins and outs of Terminal. But Apple has put together a useful Terminal User Guide that is a very good place to start.

However, there is one type of Terminal function that’s especially relevant and useful here. And that involves navigating to the folder that holds the image files. The commands above assume that the images are all in a single flat folder. So it’s much easier and simpler if you can get navigate to that folder from the get-go.

There are multiple ways to do that. Some of the easiest are:

Terminal Command

In Terminal, use the cd (change directory) command to navigate to the desired directory. For example: cd /path/to/your/folder.

Hybrid Finder/Terminal Command

In the terminal console, type cd (with a space after it) and then drag and drop the folder from Finder into the Terminal window. Press Enter.

Services Menu

This is enabled by default in macOS, but if you don’t see it, you might need to enable it first (more on that below).

Right-click (or CTRL-click) on the folder containing the images in Finder. Choose Services > New Terminal at Folder.

If you don’t see that in the list of available services, you can enable it in System Preferences > Keyboard > Shortcuts > Services and then make sure that New Terminal at Folder is checked.

Assign a Keyboard Shortcut

If it’s something you need to do often, you can combine the Services with a custom keyboard shortcut. You can assign that through System Preferences > Keyboard > Shortcuts > Services. Find the service called New Terminal at Folder, double click on none and then press whatever key combination you want to use.

Other Alternatives for Resizing Images

There are, of course, many methods and apps you can use to resize images. It’s something that any image editing app worth its salt can do.

But the reality is that some methods work better for very large numbers of images better than others.

Many apps will choke when you try to add very large numbers of image, especially if the app is trying to pre-scan and pull up a thumbnail preview of every image. But SIPS doesn’t care about thumbnails, so it doesn’t run into that problem.

But if you want something with a more user-friendly graphical user interface, I’d recommend taking a look at XnView (free) or BatchPhoto (paid). Of course, you can also do it with apps like Lightroom, Adobe Bridge, Photoshop, Gimp, or any number of other image editing apps. But, like I said at the outset, sometimes I find it quicker, more efficient, and simpler to do it with SIPS.

Profile photo of David Coleman | Have Camera Will Travel | Washington DC-based Professional Photographer

Text & Photos by David Coleman

I'm a professional photographer based in Washington DC. Seven continents, up mountains, underwater, and a bunch of places in between. I've been shooting for 30+ years, and my my photos and time-lapse videos have appeared in a bunch of different publications from major newspapers to magazines and books, billboards, TV shows, professional sports stadiums, museums, and even massive architectural scrims covering world-famous buildings while they're being renovated. You can see some of my travel photography here and here.

Leave a Comment