DokuWikiの意図せぬ画像回転に対応2024/08/12 20:03

DokuWikiに貼った縦長画像が横長に表示されることに気付いた。 ページ作成時には正しく表示された記憶があり、原因不明のまま放置してたが、夏休みなので調べてみた。

DokuWikiのフォーラムで Images are rotated?Unintended image rotationが見つかり、 原因はJPEG画像にあることが分かり、exif情報を見比べるとOrientationタグが異なることに気付いた。

$ exiftool -Orientation img_0103.jpg ✗な画像
Orientation                     : Rotate 90 CW
$ exiftool -Orientation img_0104.jpg ◎な画像
Orientation                     : Horizontal (normal) 

exif情報の書き換えに悩んだが、下記の手順で更新できて、撮影/意図した通りに表示できるようになった。

$ exiftool "-Orientation=Horizontal(normal)" img_0103.jpg
Warning: Can't convert IFD0:Orientation (not in PrintConv)
Nothing to do.
$ exiftool -Orientation=1 -n img_0103.jpg
    1 image files updated
$ exiftool -Orientation img_0103.jpg 
Orientation                     : Horizontal (normal)

本日の衛星:ISSデジ、RS-44で交信。