Immediately resize, rotate, and flip images via the command line
You can resize, rotate, or flip any image file via the Mac’s Terminal using the command line sips tool. Manipulating images with sips is practically instantaneous, if you need to quickly resize, rotate, or flip an image file it definitely beats firing up Preview.
Resizing an image from Terminal
You can resize any image with sips using the following syntax:
sips -z 600 800 test.jpg The format is height first then width, so despite the command appearing dimensionally backwards to many computer users, the above command would resize an image to be 800 pixels wide by 600 high.
Rotating images from the Terminal
By default, sips rotates clockwise so you just need to specify the degrees you want an image rotated, like so:
sips -r 90 image.jpg The file will immediately be rotated 90 degrees clockwise.
Flip an image from the Terminal
Using sips, you can also 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 easily flip the image vertically by replacing horizontal with vertical like so:
sips -f vertical image.jpg