sips (scriptable image processing system) is is a command line program in Mac OS for reading or modifying images. In this article, we will explore how to use it for bulk image resizing.
sips is most suitable to restrict either the image's width or the height to a specific value. If you want to restrict both the width and height, the aspect ratio of the image will change. The resized image will be squashed or stretched, which will affect the photo's aesthetic value.
To start, you will need to launch Terminal. Navigate into the directory where the images are located (normally involving many cd and ls).
To resize a single image, the following command will resize the width "sample-image.jpg" into 1200px and save as "resized-image.jpg".
sips --resampleWidth 1200 sample-image.jpg --out resized-image.jpg
If you want to restrict height, change
--resampleWidth into
--resampleHeight
sips --resampleHeight 1200 sample-image.jpg --out resized-image.jpg
To bulk resize multiple images, you can set the input image as a file name pattern, such as all jpg files:
*.jpg. Before running the resizing code, create a target folder like
resized to hold all the resized images.
sips --resampleHeight 1200 *.jpg --out resized
You can add additional parameters to set the compression quality of jpeg images like this:
sips -s formatOptions 80 --resampleHeight 1200 *.jpg --out resized
You can use this parameter convert all png files into jpeg files
sips -s format jpeg -s formatOptions 80 --resampleHeight 1200 *.png --out resized