Wrong rotationAngle -> orientation map for Canon raw files?
Copied from http://uk.groups.yahoo.com/group/exiv2/message/660, from Marco Piovanelli:
I'm testing my exiv2-based code with some .crw image files coming
straight from a Canon EOS Digital Rebel camera. Some of the
pictures were shot in portrait orientation, and as expected, the
camera included a CIFF rotationAngle tag into the generated file.
My code tries to re-orient pictures by reading the "Exif.Image.Orientation"
key -- this works just fine for JPEG images, but .crw images come up
What's going on?
Libexiv2 maps the CIFF rotationAngle tag (0/90/180/270) to an
equivalent (?) Exif orientation tag (1-8), which is more readily
understood by software like mine. The code that performs the
conversion is in RotationMap::orientation() (in crwimage.cpp),
and, as far as I can tell, honors the official CIFF file format
rotationAngle: This indicates how many degrees in the counter-clockwise
direction the original data file should be rotated for correct viewing
of the image.
Unfortunately, it looks like the official spec is at odds with
real-world specimens of .crw images, like the following, where
the rotation must be performed clockwise to obtain a
(rotationAngle tag = 270, orientation tag synthesized by libexiv2 = 6,
correct orientation tag = 8)
I tried opening the above with the Preview application in Mac OS X,
with Aperture 1.5, and with Photoshop CS3 beta, and they all rotate
the image by 270 degrees clockwise. If anyone is willing to try
and open the above picture with their raw viewer and operating system
of choice, I'd like to hear their results.