2016-11-15 48 views
0

我有一組圖像具有損壞的exif方向數據。我想用imagemagick改變這些圖像的方向。我發現了以下命令mogrify -set "%[EXIF:Orientation]" BottomRight image.jpg,但是當我使用Identify -verbose image.jpg檢查圖像時,它的方向數據未定義似乎不起作用。使用imagemagick設置圖像方向exif數據

回答

1

不知道是否/如何可以做到這一點與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 
1

隨着imagemagick你可以按照以下方式做到這一點。

mogrify -orient <orientation> *.jpg

有效取向

bottom-left  
right-top 
bottom-right 
top-left 
left-bottom  
top-right 
left-top  
undefined 
right-bottom 

更多信息here

您可以使用識別來驗證你的變化

identify -verbose input.jpg | grep orientation