sips β Scriptable Image Processing System#
sips is macOSβs built-in image manipulation tool. No install required β handles conversion, resizing, rotation, color profiles, and metadata queries entirely from the terminal.
Inspect an image#
sips image.png # summary: format, size, color space
sips -g all image.png # all metadata properties
sips -g pixelWidth -g pixelHeight image.png # just dimensions
sips -g format image.png # file format
sips -g dpiWidth -g dpiHeight image.png # DPI
sips -g colorSpace image.png # e.g. RGB, Gray, CMYK
sips -g bitsPerSample image.png # bit depth
sips -g hasAlpha image.png # true/false
sips -g profile image.png # embedded ICC profile
sips -s format jpeg image.png --out output.jpg # PNG β JPEG
sips -s format png image.jpg --out output.png # JPEG β PNG
sips -s format tiff image.jpg --out output.tiff # β TIFF
sips -s format gif image.png --out output.gif # β GIF
sips -s format bmp image.png --out output.bmp # β BMP
sips -s format pdf image.png --out output.pdf # β PDF (single page)
sips -s format heif image.jpg --out output.heif # β HEIF/HEIC
# Supported output formats:
# jpeg | tiff | png | gif | jp2 | pict | bmp | qtif | psd | sgi | tga | pdf | heif
JPEG quality#
sips -s format jpeg -s formatOptions 80 image.png --out out.jpg # 80% quality
sips -s format jpeg -s formatOptions 50 image.png --out out.jpg # 50% (smaller)
sips -s format jpeg -s formatOptions best image.png --out out.jpg # best quality
sips -s format jpeg -s formatOptions low image.png --out out.jpg # low quality
# formatOptions values: 0-100 integer, or: low | normal | high | best | lzw | packbits
Resize#
# Fit within a bounding box (preserves aspect ratio)
sips -Z 800 image.png # fit within 800Γ800, in-place
sips -Z 800 image.png --out resized.png # save to new file
# Set exact pixel width (height scales proportionally)
sips --resampleWidth 1200 image.png --out wide.png
# Set exact pixel height (width scales proportionally)
sips --resampleHeight 600 image.png --out tall.png
# Set exact dimensions (may distort aspect ratio)
sips --resampleHeightWidth 600 800 image.png --out exact.png
# Set exact dimensions, constrained (no distortion)
sips --resampleHeightWidthMax 600 800 image.png --out fitted.png
# Resize to a percentage of original size
sips --resampleWidth $(sips -g pixelWidth image.png | awk '{print int($2 * 0.5)}') image.png
Crop#
# Crop to exact dimensions from top-left
sips -c 400 600 image.png # crop to 400px tall Γ 600px wide (h w order)
# Crop and save to new file
sips -c 400 600 image.png --out cropped.png
# Crop a region: -c height width (from the top-left corner)
sips -c 300 500 image.png --out banner.png
Rotate & flip#
sips -r 90 image.png # rotate 90Β° clockwise
sips -r 180 image.png # rotate 180Β°
sips -r 270 image.png # rotate 270Β° clockwise (= 90Β° CCW)
sips -r -90 image.png # rotate 90Β° counter-clockwise
sips -f horizontal image.png # flip horizontally (mirror)
sips -f vertical image.png # flip vertically
# Combine: rotate then flip
sips -r 90 -f horizontal image.png --out result.png
Color profiles & color space#
# Match to a profile
sips -m /System/Library/ColorSync/Profiles/sRGB\ Profile.icc image.png
# List available profiles
ls /System/Library/ColorSync/Profiles/
# Strip profile (embed none)
sips -e image.png # embed no profile
# Set color space
sips --setProperty colorSpace "RGB" image.png
sips --setProperty colorSpace "Gray" image.png
# Convert to sRGB (common web workflow)
sips -m /System/Library/ColorSync/Profiles/sRGB\ Profile.icc \
-s format jpeg image.png --out web.jpg
Padding#
# Add equal padding (canvas extension)
sips -p 200 300 image.png # pad to 200Γ300 (h w); fills with white
sips -p 500 500 image.png --out padded.png
Batch processing#
# Convert all HEIC to JPEG in current directory
for f in *.heic; do
sips -s format jpeg "$f" --out "${f%.heic}.jpg"
done
# Convert all HEIC to JPEG (case-insensitive)
for f in *.HEIC *.heic; do
[[ -f "$f" ]] && sips -s format jpeg "$f" --out "${f%.*}.jpg"
done
# Resize all PNG files to max 1200px (in-place)
for f in *.png; do sips -Z 1200 "$f"; done
# Resize all images, save to a resized/ subdirectory
mkdir -p resized
for f in *.jpg *.jpeg *.png; do
[[ -f "$f" ]] && sips -Z 800 "$f" --out "resized/$f"
done
# Convert all PNG in a folder to JPEG at 85% quality
for f in *.png; do
sips -s format jpeg -s formatOptions 85 "$f" --out "${f%.png}.jpg"
done
# Process every image inside a directory tree
find . -iname "*.png" | while read f; do
sips -Z 1920 "$f"
done
# Get dimensions of every image in a folder
for f in *.png *.jpg; do
[[ -f "$f" ]] && echo "$f: $(sips -g pixelWidth -g pixelHeight "$f" | tail -2 | awk '{printf $2" "}')"
done
Combine operations#
# Resize + convert + quality in one pass
sips -Z 1200 -s format jpeg -s formatOptions 85 input.png --out output.jpg
# Rotate + resize + convert
sips -r 90 -Z 800 -s format jpeg input.heic --out output.jpg
# Crop + convert
sips -c 900 1200 -s format png input.jpg --out thumb.png
# Remove all metadata (strip EXIF, profiles)
sips -e image.jpg # strip color profile
# For full EXIF strip, use exiftool (brew install exiftool)
# Set DPI
sips --setProperty dpiWidth 72 --setProperty dpiHeight 72 image.png
sips --setProperty dpiWidth 300 --setProperty dpiHeight 300 image.tiff
# Set description / title (limited support)
sips --setProperty description "My Image" image.png
Output directory#
# --out can be a file or a directory
sips -Z 800 image.png --out resized.png # specific filename
sips -Z 800 *.png --out ./resized/ # all PNGs into a dir
# When --out is a dir, filenames are preserved
Common recipes#
# Prepare images for web (resize + sRGB + JPEG 85%)
for f in *.png *.jpg; do
[[ -f "$f" ]] && sips -Z 1920 \
-s format jpeg -s formatOptions 85 \
-m /System/Library/ColorSync/Profiles/sRGB\ Profile.icc \
"$f" --out "web/${f%.*}.jpg"
done
# Create square thumbnails (crop to center then resize)
# Note: sips crops from top-left; center-crop needs AppleScript or ImageMagick
sips -c 800 800 image.jpg --out square.jpg
# Check if image has alpha channel (useful in scripts)
has_alpha=$(sips -g hasAlpha "$f" | awk '/hasAlpha/{print $2}')
[[ "$has_alpha" == "yes" ]] && echo "Has alpha: $f"
# Batch rename + convert
i=1
for f in *.heic; do
sips -s format jpeg "$f" --out "photo_$(printf "%03d" $i).jpg"
((i++))
done
# Reduce screenshot size for sharing
sips -Z 1280 -s format jpeg -s formatOptions 75 screenshot.png --out screenshot_small.jpg
# Convert sRGB PNG to print-ready 300 DPI TIFF
sips --setProperty dpiWidth 300 --setProperty dpiHeight 300 \
-s format tiff image.png --out print.tiff
Quick reference β property names#
| Property | Description |
|---|
pixelWidth | Width in pixels |
pixelHeight | Height in pixels |
dpiWidth | Horizontal DPI |
dpiHeight | Vertical DPI |
colorSpace | RGB, Gray, CMYK, etc. |
bitsPerSample | Bit depth (8, 16, β¦) |
samplesPerPixel | Channels (3=RGB, 4=RGBA) |
hasAlpha | yes / no |
format | jpeg, png, tiff, heif, β¦ |
formatOptions | Quality / compression |
profile | Embedded ICC profile name |
Quick reference β flags#
| Flag | Description |
|---|
-g prop | Get property value |
-s prop val | Set property value |
-Z n | Fit within nΓn (preserves ratio) |
--resampleWidth n | Set width, scale height |
--resampleHeight n | Set height, scale width |
--resampleHeightWidth h w | Exact size (may distort) |
-c h w | Crop to hΓw from top-left |
-r deg | Rotate (90/180/270/-90) |
-f dir | Flip (horizontal/vertical) |
-p h w | Pad canvas to hΓw |
-m profile.icc | Match color profile |
-e | Strip embedded profile |
--out path | Output file or directory |