Command Line Image Tools

From Littledamien Wiki
Jump to navigation Jump to search

sips

sips is a command line tool installed by default on Mac OS.

It can be used to flip and resize image files.

# changes aspect ratio
$ sips -z [height] [width] path/to/image.jpg
# maintains aspect ratio
$ sips -z [heightwidth] path/to/image.jpg
# rotate image
sips -r 90 path/to/file.jpg --out rotatedfile.jpg

It can also be used to inspect an image's metadata:

$ sips -g all path/file.extension

  pixelWidth: 1920
  pixelHeight: 1080
  typeIdentifier: public.jpeg
  format: jpeg
  formatOptions: default
  dpiWidth: 72.000
  dpiHeight: 72.000
  samplesPerPixel: 3
  bitsPerSample: 8
  hasAlpha: no
  space: RGB
  profile: sRGB IEC61966-2.1

exiftool

exiftool can be used to inspect an image's metadata, e.g.:

$ exiftool paris-texas-00_05_34-00001.jpg

ExifTool Version Number         : 12.49
File Name                       : paris-texas-00_05_34-00001.jpg
Directory                       : .
File Size                       : 310 kB
File Modification Date/Time     : 2023:04:07 09:28:48-07:00
File Access Date/Time           : 2023:04:07 11:13:20-07:00
File Inode Change Date/Time     : 2023:04:07 09:28:48-07:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Image Width                     : 1920
Image Height                    : 1080
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1920x1080
Megapixels                      : 2.1

ffmpeg

ffmpeg is useful for converting image files to different formats.

See also