Immediately resize, rotate, and flip images via the command line

Jul 13, 2010 - 6 Comments

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

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Bill Ellis in Command Line, Tips & Tricks

6 Comments

» Comments RSS Feed

  1. matt says:

    Hey,
    Do you know if there is a way to specify JPEG quality with sips? With the orientation example this shouldn’t matter as it is possible to change the orientation of a JPEG (I think in Exif rather than JFIF JPEGS?) via metadata so the image data is not recompressed, but I am intrigued to know what sips setting is for uncompressed (say TIFF) to JPEG?
    I can’t find it in the man page!

  2. steve says:

    is there a way to run sips from command line quietly ie no messages?

  3. Vin says:

    Does sips open .eps images? Any alternative from command line to change the resolution of a .eps image? Thanks

  4. nick says:

    Using this method… is there a way to batch resize images by percentage? ie… resize to 50% of the original size instead of having to specify the resolution.

  5. [...] it still handles batch processing bulk photos just fine. Also, you can tweak and resize images from the command line tool sips, which requires usage of the Terminal and thus may be considered more advanced, but it can be [...]

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

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