3

I have a set of images with corrupt exif orientation data. I would like to change the orientation of these images using imagemagick. I found the following command mogrify -set "%[EXIF:Orientation]" BottomRight image.jpg but it does not seem to work when I inspect the image using Identify -verbose image.jpg the orientation data is Undefined.

Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102

2 Answers2

6

With ImageMagick you can do it in the following way:

mogrify -orient <orientation> *.jpg

Valid orientations are

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

More info here.

You can use identify to validate your change:

identify -verbose input.jpg | grep Orientation

Sebastian
  • 1,710
  • 2
  • 16
  • 28
Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102
5

Not sure if/how you can do that with ImageMagick, but you might like to use exiftool as follows:

# 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

Here is a little loop to test all 8 values:

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
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432