【问题标题】:Setting image orientation exif data using imagemagick使用 imagemagick 设置图像方向 exif 数据
【发布时间】:2016-11-15 09:39:13
【问题描述】:

我有一组带有损坏的 exif 方向数据的图像。我想使用 imagemagick 更改这些图像的方向。我找到了以下命令mogrify -set "%[EXIF:Orientation]" BottomRight image.jpg,但是当我使用Identify -verbose image.jpg 检查图像时,它似乎不起作用,方向数据未定义。

【问题讨论】:

    标签: command-line imagemagick mogrify


    【解决方案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 来验证您的更改:

    identify -verbose input.jpg | grep Orientation

    【讨论】:

      【解决方案2】:

      不确定是否/如何使用 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
      

      【讨论】:

        猜你喜欢
        • 2013-10-27
        • 2011-09-19
        • 1970-01-01
        • 2018-12-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-06-02
        • 2014-11-05
        相关资源
        最近更新 更多