Batch Resize a Group of Pictures from the Command Line with sips

Nov 25, 2012 - 7 Comments

Batch resize group of pictures 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

.

Related articles:

Posted by: William Pearson in Command Line, Mac OS, Tips & Tricks

7 Comments

» Comments RSS Feed

  1. Thibault says:

    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

  2. diselsamm says:

    Another possible solution is to use Gimp, an excellent free software.

  3. Lauri Ranta says:

    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

  4. nlapjr says:

    Thanks! Great help!
    Maybe you can feature more Automator tips and tricks.
    That app has a lot of potential but is not covered much.

  5. pr10n says:

    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

  6. Dante says:

    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.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site