Skip to content

Instantly share code, notes, and snippets.

@TommyPKeane
Last active February 23, 2023 22:02
Show Gist options
  • Save TommyPKeane/fa479f43ace9b7aec6d2d8f5c87e7ff4 to your computer and use it in GitHub Desktop.
Save TommyPKeane/fa479f43ace9b7aec6d2d8f5c87e7ff4 to your computer and use it in GitHub Desktop.
`sips` (Scriptable Image Processing System) commandline utility examples and tips in bash syntax (https://ss64.com/osx/sips.html)
# Convert JPEG (filename.jpg) to PNG (filename.png)
sips -s format png filename.jpg --out filename.png
# Convert PNG (filename.png) to JPEG (filename.jpg)
sips -s format jpeg filename.png --out filename.jpeg
# Get PNG Image (filename.png) Size and DPI Info
sips -g dpiHeight -g dpiWidth -g pixelHeight -g pixelWidth -g samplesPerPixel -g bitsPerSample -g typeIdentifier filename.png
# Example Output:
# /path/to/filename-a.png
# dpiHeight: 72.000
# dpiWidth: 72.000
# pixelHeight: 851
# pixelWidth: 851
# samplesPerPixel: 3
# bitsPerSample: 8
# typeIdentifier: public.png
# SIPS (Scriptable Image Processing System)
#
# References:
# - https://ss64.com/osx/sips.html
#
#
# Note, per Documentation, the `sips -s format {STRING}` command supports the following formats for conversion:
# - jpeg
# - tiff
# - png
# - gif
# - jp2
# - pict
# - bmp
# - qtif
# - psd
# - sgi
# - tga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment