Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.14 KB

rotate-an-image-to-be-oriented-upright.md

File metadata and controls

27 lines (21 loc) · 1.14 KB

Rotate An Image To Be Oriented Upright

Many programs that display JPEG images will read the EXIF data for 'Orientation' headers so that they can correctly display the image. Not all of them though. For instance, when a browser renders an <img> tag for such a JPEG image, it won't account for the 'Orientation' header and you might end up with a sideways image.

You can normalize the orientation with the jhead utility which uses jpegtran under the hood. This is done with the -autorot flag.

$ jhead -autorot my_image.jpeg

Using the 'Orientation' tag of the Exif header, rotate the image so that it is upright. The program 'jpegtran' is used to perform the rotation. After rotation, the orientation tag of the Exif header is set to '1' (normal orientation). The Exif thumbnail is also rotated.

This feature is especially useful with newer digital cameras [and smartphones], which set the orientation field in the Exif header automatically using a built in orientation sensor in the camera.

The image will now be upright in all programs.