Imagemagick 获取真实的宽高

Imagemagick get real width and heigth

magick identify -format "{w: %w, h: %h, o: %[orientation]}" img.png

我运行此命令确定图像的尺寸。问题是,有时方向是 w 和 h 在实践中交换。我怎样才能得到人们打开图片时看到的“实际”尺寸?是否有内置命令来获取这些,或者是否有关于何时特定方向意味着我必须交换 w 和 h 的规则?

您想要 -auto-orient 选项:

magick INPUT.JPG -auto-orient -format "{w: %w, h: %h, o: %[orientation]}" info: