sips - macOS


sips

Overview

sips is a versatile command-line tool designed exclusively for macOS that enables users to perform a wide range of image processing tasks. It offers a comprehensive set of image manipulation capabilities, from resizing and cropping to adjusting color and applying filters.

Syntax

sips [options] [input-file] [output-file]

Options/Flags

  • -s Resize the image to a specific width or height:

    • -s width height: Set the exact dimensions
    • -s size: Set the maximum dimension, while maintaining the aspect ratio
  • -z Resize the image to a specific resolution:

    • -z width height: Set the exact resolution in pixels per inch (ppi)
  • -c Crop the image to a specific size:

    • -c width height: Set the exact crop size
    • -c x y width height: Crop from a specific position
  • -f Specify the output image format:

    • -f format: Set the format (e.g., JPEG, PNG, TIFF)
  • -q Adjust image quality:

    • -q 0-100: Set the quality level for JPEG output
  • -r Rotate the image:

    • -r degrees: Rotate by a specific angle
  • -A Adjust color settings:

    • -A auto: Auto-adjust brightness, contrast, and saturation
    • -A brightness contrast saturation: Set specific values
  • -e Apply image effects:

    • -e [effect-name] [parameters]: Apply a wide range of effects (e.g., sharpen, blur, etc.)

Examples

  • Resize an image to 800 pixels wide:

    sips -s 800 input.jpg output.jpg
    
  • Crop an image to 200×300 pixels:

    sips -c 200 300 input.png output.png
    
  • Convert an image to PNG format:

    sips -f png input.jpg output.png
    
  • Auto-adjust the color of an image:

    sips -A auto input.jpg output.jpg
    
  • Apply a Gaussian blur effect:

    sips -e gaussian-blur 5 input.jpg output.jpg
    

Common Issues

  • Grainy output: Lower the JPEG quality (-q) to reduce file size.
  • Incorrect dimensions: Verify the image dimensions and units (e.g., pixels vs. inches).
  • Color inaccuracies: Adjust the color settings (-A) to achieve the desired results.

Integration

  • Automate image processing tasks in scripts or workflows.
  • Combine with other image processing tools, such as ImageMagick.
  • Use in conjunction with macOS Automator for point-and-click automation.

Related Commands

  • ImageMagick: A comprehensive image processing suite with a GUI and command-line interface.
  • Preview: macOS’s built-in image viewer with basic editing capabilities.
  • GraphicsMagick: A lightweight and fast image processing library.