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.
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