- slide 1 of 3
There are many useful instances in which someone might want to resize images. For example, many e-commerce websites feature thumbnails for products. If a web designer is making a site that offers thousands of products and each one needs a thumbnail preview generated, this can be quite a laborious task unless you write a script in Photoshop or buy another program that is intended to do this job.
Fortunately, Mac OS X includes an awesome little utility called SIPS. This great command line tool can resize images quickly and efficiently. You can constrain the images by width or height while maintaining the aspect ratio, or you can specify the exact size that you want all images to be.
- slide 2 of 3
How to Resize the Easy Way
In order to resize your images, you need to first determine how you'd like for them to be resized. The options that sips gives you are resizing to a specified width, specified height, or specified size. Alternatively, you can resample your images so that either the width or the height (depending on the dimensions) will be a specified amount, and the other dimension will be resized proportionately. We'll take a look at which command to use below:
If you want the image(s) to have a specific width: Use the command "sips --resampleWidth [number] [filename(s)]", where [number] is the width, in pixels, you'd like the image to be, and [filename(s)] is the name of your file, a space separated list of files, or *.* to signify all files in the directory.
If you'd like for the image(s) to be uniform height: Use the command "sips --resampleHeight [number] [filename(s)]", where the variables are as described above.
If you want to resample the image(s) to be an exact height and width: Use the command "sips --resampleHeightWidth [number] [filename(s)]".
If you want the image(s) to be resized such that they fit in a bounding box: Use the command "sips --resampleHeightWidthMax [number] [filename(s)]". This command will take the longest dimension, shrink or expand it to [number], and shrink or expand the other dimension proportionately. Thus, if you have an image that's 400x200 and set the number to 100, the resulting image will be 100x50. Conversely, if the image is 200x400, the image will be 50x100.
When you've decided how you'd like to resize the images, simply enter the above command by opening Utilities -> Terminal and typing the command there. If you'd like to resize all the images in a directory, enter "sips --resample[mode] [number] /[pathtomydirectory]/*.*".
- slide 3 of 3
Resizing lots of images in OS X is impressively easy with this little known command. However, as with any operation, it's important that you remember that this will make irreversible changes to your files. That is, after you run the command on an image, it will be permanently resized. Hence, it's a good idea to make a backup copy of your image just in case you're unhappy with the effects or would like to resize it to different dimensions. In my experience though, sips does quite a good job of resizing the images and the quality definitely rivals commercial tools such as Photoshop.
If you'd like to learn about the other features of sips, you can do so by going to Terminal and typing "man sips". This will bring up all the parameters that sips accepts.