Wikia

How To Wiki

How to auto-rotate digital photos to their proper orientation

Talk0
1,791pages on
this wiki



Some digital cameras can record the orientation of the camera when the photo is taken. This is stored in the image's Exif data. The images can be rotated 90°, 180°, 270°, or none if the picture is in the normal orientation.

This may not work on images from all digital cameras. The camera must be equipped with a built-in orientation sensor. If the camera lacks such a sensor, images would need to be rotated manually, on a case-by-case basis.

GraphicalEdit

  • Using f-spot to rotate images
    • Photo management software such as mono's f-spot will automatically rotate photos with the proper meta-data upon import.
    • http://www.f-spot.org
  • Using Rasco Resizer
    • It allows user to automatically rotate pictures based on EXIF data, rotate and watermark.

Command lineEdit

The standard JPEG library includes two programs, jpegexiforient and jpegtran. A shell script named exifautotran uses these programs to read Exif data labeled Orientation and automatically rotates the image to the proper orientation — 90°, 180°, 270°, or none.

Most Unixes, such as Linux, have the jpeg library installed by default, but if yours doesn't:

  • Download jpegsrc-*.tar.gz, compile and install, or install it using your favorite package manager
  • See if your jpeg package includes exifautotran. If it doesn't, get the code, save it to your hard drive, and make it executable with chmod 755 exifautotran.
  • To rotate a single image, execute:
exifautotran image_name
  • To rotate all images in a directory automatically, execute:
exifautotran *

See http://jpegclub.org/exif_orientation.html for details

Note: The exifautotran script uses the command jpegexiforient to figure out the orientation stored in the Exif label of a file. However, it may fail to read JPEG files storing JFIF standard 1.01 information. Reading such files can be performed manually using the exiftool utility.

For example, the following command will retrieve orientation information from a JFIF file:

exiftool -t -s -n -IFD0:Orientation -IFD1:Orientation

And to set the orientation in both IFD0 and IFD1 tags to default (no rotation), use:

exiftool -n -IFD0:Orientation=1 -IFD1:Orientation=1

External linksEdit

From HowTo Wiki, a Wikia wiki.

Around Wikia's network

Random Wiki