我有一组带有损坏的 exif 方向数据的图像。我想使用 imagemagick 更改这些图像的方向。我找到了以下命令,但是当我使用未定义的方向数据mogrify -set "%[EXIF:Orientation]" BottomRight image.jpg
检查图像时,它似乎不起作用。Identify -verbose image.jpg
问问题
4574 次
2 回答
6
使用 ImageMagick,您可以通过以下方式进行操作:
mogrify -orient <orientation> *.jpg
有效的方向是
bottom-left
right-top
bottom-right
top-left
left-bottom
top-right
left-top
undefined
right-bottom
更多信息在这里。
您可以使用 identify 来验证您的更改:
identify -verbose input.jpg | grep Orientation
于 2016-11-25T11:49:32.733 回答
5
不确定是否/如何使用ImageMagick做到这一点,但您可能希望使用exiftool如下:
# Set orientation with exiftool
exiftool -Orientation=3 -n input.jpg
1 image files updated
# Check with **ImageMagick**
identify -verbose input.jpg | grep rient
Orientation: BottomRight
exif:Orientation: 3
这是一个测试所有 8 个值的小循环:
for x in {1..8}; do
exiftool -Orientation=$x -n input.jpg > /dev/null
identify -verbose input.jpg | grep Orientation
done
Orientation: TopLeft
exif:Orientation: 1
Orientation: TopRight
exif:Orientation: 2
Orientation: BottomRight
exif:Orientation: 3
Orientation: BottomLeft
exif:Orientation: 4
Orientation: LeftTop
exif:Orientation: 5
Orientation: RightTop
exif:Orientation: 6
Orientation: RightBottom
exif:Orientation: 7
Orientation: LeftBottom
exif:Orientation: 8
于 2016-11-16T10:25:40.513 回答