全てが縦長の画像であれば対処は単純なのですが、横長と混在している状態だとどうしたらいいの?ってなります。が、ご安心。ImageMagickに素敵なオプションがありました。
auto-orientです。次のように使うと、縦長の画像だけ判定して90度回転してくれます。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# auto-orientを使えばよしなに処理してくれます。 | |
$ ls *.jpg | xargs -I{} convert {} -auto-orient -verbose conved/{} | |
# conved/ディレクトリに*.jpgで縦長画像は90度回転、横長画像はそのままの画像が生成されます。 |
0 件のコメント:
コメントを投稿