31
10
When I make pictures with my camera (Olympus E-520), in the EXIF data the orientation is stored.
The standard image viewer on Ubuntu is displaying this images correctly. Windows viewer however not.
Is there a way to really rotate this images (if necessary according to EXIF) in a batch on Ubuntu? For example with an ImageMagick tool?
Works for me :
ls *.JPG | xargs -I {} exiftran -i -a {}
– mrgloom – 2017-11-24T16:07:59.2701exiftran looks like it's exactly what I need! – Peter Smit – 2009-09-10T12:45:52.670
3
jhead -autorot invokes jpegtran, which can do perfectly lossless rotation. I'd forgotten all about the lossless stuff by IJG. http://jpegclub.org/losslessapps.html Exiftran can also do lossless rotation, and is better than jpegtran because it respects exif information in the image file. You should note however that sometimes (and I'm not sure on all the details) you can't losslessly rotate. So if you implement a script with jhead to identify the necessary rotation (similar to my previous, but with a case statement to handle all rotations) you should support falling back to lossy rotation.
– opello – 2009-09-14T04:00:40.4901I did a few tests with exiftran -a (auto rotate based on exif orientation tag), and it seems to work very well. With regard to lossless rotation, I couldn't get the source image back by performing the inverse of the performed rotation. E.g. exiftool -F 1.jpg -o 2.jpg; exiftool -F 2.jpg -o 3.jpg; md5sum of 1.jpg and 3.jpg are not the same. Upon closer inspection (with Araxis merge binary comparison) sometimes it was just exif header information that differed, other times it was major changes in the file. However Araxis merge's image comparison showed no unchanged pixels. – opello – 2009-09-14T05:12:08.323
I meant no changed* pixels (they were pixel-identical images).
Also -- I'm not sure on the stackoverflow/superuser protocol, but I think dmityugov should get this one for recommending the proper tool. – opello – 2009-09-14T05:21:01.560
1I found that exiftran can remove some metadata from file. For example, images taken by Samsung Galaxy S2 have timestamp field (possibly non-EXIF), and exiftran will remove it. exiftran -a also will alter image which doesn't need rotation. jhead -autorot is free from both issues. OTOH, it lacks option to preserve file mtime (but there's -ft switch as a workaround). – pfalcon – 2013-08-21T20:00:17.217