Does auto-orient in Imagemagick rotate image pixels?

785 Views Asked by At

I want to know what does following Imagemagick command exactly does:

convert input.jpg -auto-orient out.jpg

Does it just read and update exif ? Or does it also rotate the pixels present in the image?

1

There are 1 best solutions below

0
xenoid On

Taking a vertical picture from my camera (orientation in Exif data):

  • IM identify says:

    Test.jpg JPEG 5472x3648 5472x3648+0+0 8-bit sRGB 6.907MB 0.000u 0:00.000
    
  • The Linux file command says (extracts):

    Test.jpg: JPEG image data, Exif standard: [... orientation=lower-left, ... ], ... , 5472x3648, ...
    

After conversion,

  • IM identify says:

    Test-out.jpg JPEG 3648x5472 3648x5472+0+0 8-bit sRGB 7.082MB 0.000u 0:00.010
    
  • And file:

    Test-out.jpg: JPEG image data, Exif Standard: [...  orientation=upper-left, ...], ... , 3648x5472, ...
    

So obviously the JPEG is rewritten to have the usual orientation and be compatible with JPEG readers that don't hanfdle the EXIF orientation.