Quick way to resize images on the Mac through command line – SIPS

For one of my sites, I had a folder full of various sized images that I needed to go through and re-size. But I had other things to do, so I didn’t want to use a Photoshop Macro and all the overhead associated with it. So after searching, I found SIPS (Scriptable Image Processing System). As far as I know, this is only available on the Mac (or more detailed, Darwin), and is part of Leopard. The manual is dated April 2008, and I don’t have a Tiger or below machine to test this on.

Browsing through the manual, you can see SIPS has a ton of uses. Everything from converting formats, resizing, work with ColorSync profiles, and more. All I needed it for was just to re-size a bunch of images (which were already in JPG format).

  1. Made a backup of my original folder
  2. Opened up a Terminal.app window (This is under your /Applications/Utilities/ folder.
  3. Moved to the image directory (‘cd ~/Desktop/origImages/’)
  4. Called SIPS to re-size everything (‘sips –resampleHeightWidth 120 160 *.jpg’).

This command is just saying ‘re-size everything to 120 x 160 pixels with a file name ending in .jpg. If everything was in mixed formats (but still images), you could change *.jpg to *.*, which means ‘all file names and all extensions’.

The best part about SIPS is that it has very little overhead, but quite powerful at the same time. While running on our Core2Duo iMac (2.2Ghz, 3GB of RAM), It only took a few seconds for a couple hundered images. You can also easily create BASH scripts. You could easily write a script (and create a cronjob for it) to resize all images in a watch folder, then copy them to another folder, etc.

Finally, SIPS is easily integrated into AppleScript, without having to much ‘command line’ detail. You can reach most of its functionality from the Image Events parts of AppleScript.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s