Make Imagemagick put text in the intended corner of pseudo rotated photos

published Aug 21, 2013 02:30   by admin ( last modified Oct 30, 2013 01:00 )

Photos from digital cameras nowadays may contain metadata about which side is actually up on the photo. All image viewers I have tried on Ubuntu heeds this and auto rotates the photos for you. But Imagemagick does not understand this auto-rotation stuff and will put your text in the wrong place on some pictured because from Imagemagick's point of view the image is not rotated.

So how do you rotate them so Imagemagick gets it right? The image viewers won't help you since they "lie" to you and will show the image corrected rotationally. One of my image viewers has a setting for disabling this auto rotate behavior, but the setting does not work.

Update 2013-10-30:

Use exiftran

It will rotate the pictures based on the exif orientation information, and update that information.

exiftran -ai *.JPG

Old solution:

What you need to do is strip the metadata from the photos, and then use the image viewer of your choice (e.g. Gwenview), to see which pictures in fact aren't correctly rotated and rotate them.

Then use Imagemagick. This command will strip all metadata from your photos:

exiftool -all= *.JPG

 

It can probably be configured to just strip some of it it, if need be.