ImageMagick:如何确定jpeg文件的方向? [英] ImageMagick: how to determine orientation of jpeg file?
问题描述
什么ImageMagick命令会显示JPG文件的方向?
What ImageMagick command will display the orientation of a JPG file?
推荐答案
您可以使用
identify -format '%[EXIF:Orientation]' <image.jpg>
根据 识别-format
docs (关于exif元数据的情况有点下降)。
as per identify -format
docs (It's the bit further down about exif metadata).
尝试
identify -verbose <image.jpg>
要查看图像中的元数据(例如,如果图像未使用相机拍摄,不会设置方向标记。)
To see what metadata is in the image (for example if the image was not taken with a camera, the orientation tag will not be set).
或者您可以执行类似
identify -format '%wx%h' <image.jpg>
它为您提供高度宽度(例如'800x598','1936x2592')并使用这些来确定图像是否正直(不确定这是多么可靠 - 有时您使用相机拍摄肖像图像,EXIF数据将正确记录方向,但图像可能仍然出现横向)。
which gives you the width by height (e.g. '800x598', '1936x2592') and use these to determine whether the image is upright or not (not sure how reliable this is though - sometimes you take a portrait image with a camera and the EXIF data will correctly record the orientation, but the image may still appear landscape).
这篇关于ImageMagick:如何确定jpeg文件的方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!