Correct exif data on rotation, using jhead

boss

Joined: 2003-05-28
Posts: 26
Posted: Tue, 2004-05-25 21:34

A bug in Gallery I've discovered was that if I move photos from an album to another, they get autorotated another time, thus incorrectly. To fix this, the Orientation exif tag has to be reset. jhead can do this with the -norot parameter. jhead can do even better in fact, but this requires a little extra logic in Gallery -autorot performs rotations, using jpegtran, and can thus only be used if both jhead and jpegtran are installed. This will fix the Orientation tag, as well as the height/width tags

-autorot
Using the 'Orientation' tag of the Exif header, rotate the
image so that it is upright. The program jpegtran is used to
perform the rotation. This program is present in most Linux
distributions. For windows, you need to get a copy of it.
After rotation, the orientation tag of the Exif header is set
to '1' (normal orientation). The thumbnail is not rotated
(that would be much harder). Other fields of the Exif header,
including dimensions are untouched, but the jpeg height/width
are adjusted. This feature is especially useful with newer
Canon cameras, that set the orientation tag automatically using
a gravity sensor.

-norot Clears the rotating field in the Exif header without altering
the image. Useful if the images were previously rotated with-
out clearing the Exif rotation tag, as some image browsers will
auto rotate images when the rotation tag is set.

At least implement the -norot code, since that would fix what I consider to be quite a serious bug in the autorotation code. Thanks!

 
boss

Joined: 2003-05-28
Posts: 26
Posted: Tue, 2004-05-25 21:55

Actually, I am no longer sure about this sentence:

Other fields of the Exif header,
including dimensions are untouched, but the jpeg height/width
are adjusted.

Does that mean anything further is actually modified? Possibly not, width/height just changes because of jpegtran. If that is the case, -autorot is completely unnecessary, gallery has jpegtran rotation code, so all that is useful/necessary is the -norot call on each rotated image.