Flip, Rotate, Resize Images via Command Line with sips

Flip, Rotate, Resize Images via Command Line with sips

Using the Mac’s Terminal sips command line tool, you can flip, rotate or resize any image file. If you need to quickly rotate, resize, or flip an image file, it definitely beats firing up a GUI application. Sips is especially useful if you need to modify a large number of images at once. 

Flip an Image with sips from Terminal

Using the sips command, you can flip any image vertically or horizontally from the command line. 

Here’s an example:

sips -f horizontal image.jpg

This will instantly flip image.jpg horizontally. You can just as quickly flip the image vertically by replacing horizontal with vertical like so:

sips -f vertical image.jpg

For flipping images, the command syntax is:

sips -f orientation [file]

Rotating Images from sips in the Terminal

By default, sips rotates clockwise, so you’ll need to specify in degrees if you want to rotate an image:

sips -r 90 image.jpg

Changing the degrees and the -r flag will set the appropriate rotation. For example, this will rotate the image total of 180°:

sips -r 180 image.jpg

To review, the command syntax for rotation is:

sips -r degree [file]

Resizing an Image with sips in the Terminal

To instantly resize any image with sips, use the following command syntax:

sips -z 600 800 test.jpg

The sips -z flag format is height first, then width. Despite the command appearing dimensionally backwards, the above command resizes an image to 800 pixels wide by 600 high. 

The command syntax and for resizing is:

sips -z height width [file]

For these examples, I used JPG in the commands, but you can use sips on almost any image file format, whether it’s PNG, TIFF, JPEG, GIF, PDF, PICT, and many others.