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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.