Skip to content
Home » The sips Command: Convert and Resize Images from the Mac Terminal

The sips Command: Convert and Resize Images from the Mac Terminal

Every Mac ships with sips — Scriptable Image Processing System — so there is nothing to install to convert, resize, or rotate an image from the Terminal. For a single photo, the Finder is honestly quicker: right-click, Quick Actions, Convert Image. Where sips earns its place is the batch. When you have forty iPhone HEIC files to turn into JPG, or a folder of screenshots to shrink to a fixed width, one line does the whole set, and you can drop it into a script.

Everything below was run on macOS 26.5.2 with sips-316. One flag — --out — is the difference between editing a copy and overwriting your original, so it gets its own section.

See what an image is

Before changing anything, sips -g reads an image’s properties. Use -g all for the full set, or name one key to get a single value. On a 1600×1200 sample image:

$ sips -g all photo.png
photo.png
  pixelWidth: 1600
  pixelHeight: 1200
  typeIdentifier: public.png
  format: png
  formatOptions: default
  dpiWidth: 72.000
  dpiHeight: 72.000
  samplesPerPixel: 3
  bitsPerSample: 16
  hasAlpha: no
  space: RGB

The first line is the file path, shortened here to the filename; every property line below it is the real output. Those keys are also the ones you set later — format, dpiWidth, and so on — so -g all is worth running whenever a conversion does not do what you expected.

Convert HEIC to JPG (one file or a folder)

iPhone photos arrive as HEIC, which plenty of sites and older apps will not accept. -s format jpeg sets the output format, and --out names where the result goes:

$ sips -s format jpeg IMG_4021.HEIC --out IMG_4021.jpg

The batch version is the reason to be in the Terminal at all. Point --out at a folder that already exists, and sips writes every converted file into it, changing the extension to match the new format:

$ mkdir converted
$ sips -s format jpeg *.HEIC --out converted/
# each IMG_xxxx.HEIC becomes converted/IMG_xxxx.jpg

The same pattern converts to png, tiff, gif, or back to heic — swap the value after -s format. Create the output folder first; sips will not make it for you.

Resize and rotate

Two resize flags cover almost everything. -Z (capital) sets the longest side and keeps the aspect ratio, which is what you usually want. --resampleWidth pins an exact width and scales the height to match:

$ sips -Z 800 photo.jpg --out small.jpg
  small.jpg  ->  800 x 600   (from 1600 x 1200)

$ sips --resampleWidth 640 photo.jpg --out w640.jpg
  w640.jpg   ->  640 x 480

Rotate with -r and a degree value; the swap of width and height confirms it worked. You can combine operations in one call — here a rotate and a DPI change together:

$ sips -r 90 -s dpiWidth 300 -s dpiHeight 300 photo.jpg --out print.jpg
  print.jpg  ->  1200 x 1600, 300 dpi

For a flip rather than a rotate, -f horizontal or -f vertical mirrors the image.

The flag that saves your originals

This is the one thing to remember. If you leave off --out, sips edits the file in place — it overwrites your original with the modified version, no warning and no undo. Watch a 1600-pixel-wide original shrink to 300 pixels on top of itself:

$ sips -g pixelWidth photo.jpg
  pixelWidth: 1600

$ sips -Z 300 photo.jpg          # no --out
$ sips -g pixelWidth photo.jpg
  pixelWidth: 300                # the original is gone

That behavior is fine when you mean it and a disaster when you do not. The habit that avoids trouble: always pass --out with a new filename, or run the batch form that writes into a separate folder, and keep your originals untouched until you have checked the results.

JPEG quality and DPI

When you write a JPEG, -s formatOptions controls compression with a named level from low up to best. The size difference is large — the same source image written both ways:

$ sips -s format jpeg -s formatOptions low  photo.png --out q_low.jpg
$ sips -s format jpeg -s formatOptions best photo.png --out q_best.jpg
$ ls -l q_low.jpg q_best.jpg
   32,711  q_low.jpg
  347,214  q_best.jpg

Roughly a tenfold gap, so low is genuinely useful for email or web thumbnails where the file needs to be small. Note that dpiWidth and dpiHeight only change the number stored in the file’s metadata — the print resolution — not the pixel count. Setting 300 dpi does not add detail; it tells a printing app how large to render the pixels the image already has.

Flag quick reference

FlagWhat it does
-g all / -g KEYRead all properties, or one (pixelWidth, format, dpiWidth…)
-s format jpegSet output format (jpeg, png, tiff, gif, heic)
-s formatOptions lowJPEG quality, low through best
-Z 800Scale so the longest side is 800px, keeping aspect ratio
--resampleWidth 640Set an exact width, scale height to match
-r 90Rotate by the given degrees
-f horizontalFlip horizontally or vertical
-s dpiWidth 300Set stored print resolution (metadata only)
--outWrite to a new file or folder instead of overwriting

That is the whole tool for day-to-day work: read with -g, change with -s, resize with -Z, and always decide where the output goes with --out. sips has no layers, filters, or selective editing — for that reach for a real image editor or a tool like ImageMagick. But for converting a camera roll off HEIC or shrinking a folder of images before you upload them, it is already on your Mac and one line away.

Leave a Reply

Your email address will not be published. Required fields are marked *