How to automatically rotate images based on EXIF data?
You may use the free jhead (which itself uses jpegtran).
To fix a picture named "image.jpg" just type :
jhead -autorot image.jpg
To fix all JPGs having EXIF data in the current folder use :
jhead -autorot *.jpg
If once rotated the thumbnail icons do not show correctly, you could refresh them by :
- Create a new folder (keep the untitled name)
- Move the affected images into the folder
- Using Column View, move the images back into the original folder
- Delete the empty untitled folder
You can use nconvert
, which is freeware (for private and educational use) and available for Win, Linux and Mac.
This tool can rotate JPEG images lossless according to the EXIF orientation tag:
nconvert -jpegtrans exif -o 'rotated_%.jpg' *.jpg
That command will batch convert all JPEG files in the current directory and prepending their names with rotated_
. This is controlled by the -o
option, refer to nconvert -help
for more possibilities:
-o filename : Output filename
Use # to specify position of numeric enumerator
Use % to specify source filename
Use $ to specify full source pathname
Use $$ to specify source folder name