Some digital cameras can record the orientation of the camera when the photo is taken. This is recoded in the images exif data. The images can be rotated 90°, 180°, 270°, or none if the picture is OK.
This will not work on all digital cameras
- Using JPEG-EXIF autorotate in Windows Explorer, to automatically rotate by right clicking the folder containing the photos
- Using ABC-View Manager to rotate images
- Using f-spot to rotate images
- Using Rasco Resizer
- It allows user to automatically rotate pictures based on EXIF data, rotate and watermark.
The standard jpeg library comes with a two programs called jpegexiforient, and jpegtran. There is also a script dubed, exifautotran, uses these programs to reads exif data labeled Orientation, and automatically rotate the image to the proper orientation. 90°, 180°, 270°, or none.
- Most unixes such a Linux have the jpeg lib installed but if you don't:
- Download: jpegsrc-*.tar.gz, compile and install, or install it using your favorite package manager
- Create script using the code here: exifautotran code.
- check to see if your jpeg package comes with exifautotran before you waste time making the script
- don't forget to make it executable, chmod 755 exifautotran
- Execute: exifautotran image_name
- rotates a single image
- Execute: exifautotran *
- rotates all images in a directory, if needed.
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