sips-r--rotate)オプションで回転、-f--flip)オプションで反転ができる。

参考: 【sips】コマンドで画像のプロパティ情報を確認する

-rで回転する

-r <角度>で時計回りに指定した角度だけ回転する。

$ sips -g pixelWidth -g pixelHeight photo.png
/path/to/photo.png
  pixelWidth: 1200
  pixelHeight: 630

$ sips -r 90 photo.png --out rotated.png
$ sips -g pixelWidth -g pixelHeight rotated.png
/path/to/rotated.png
  pixelWidth: 630
  pixelHeight: 1200

90度回転すると幅と高さが入れ替わる。180度回転の場合は幅と高さのサイズ自体は変わらない。

90度の倍数以外の角度で回転する

90度の倍数以外の角度を指定すると、回転後の画像全体が収まるようにキャンバスが拡大される。

$ sips -r 45 photo.png --out rotated45.png
$ sips -g pixelWidth -g pixelHeight rotated45.png
/path/to/rotated45.png
  pixelWidth: 1294
  pixelHeight: 1294

拡大された分のはみ出した領域は透明にはならず、単色で塗りつぶされる。PNGのような透過対応フォーマットであってもhasAlphanoのままである。

-fで反転する

-f horizontalで左右反転、-f verticalで上下反転する。画像サイズは変わらない。

$ sips -f horizontal photo.png --out flipped.png
$ sips -g pixelWidth -g pixelHeight flipped.png
/path/to/flipped.png
  pixelWidth: 1200
  pixelHeight: 630

回転と反転を組み合わせる

-r-fは同時に指定できる。

$ sips -r 90 -f horizontal photo.png --out combined.png
$ sips -g pixelWidth -g pixelHeight combined.png
/path/to/combined.png
  pixelWidth: 630
  pixelHeight: 1200

参考

SIPS Command: Scriptable Image Processing System in macOS