[Digikam-devel] extragear/graphics/digikam/libs/dmetadata
Gilles Caulier
caulier.gilles at free.fr
Fri May 26 23:32:03 BST 2006
SVN commit 545149 by cgilles:
digikam from trunk : DMetadata : improving getImageOrientation method with Minolta cameras using Camera settings from MakerNote. Minolta is the only maker (i think) to set un-properlly the Exif image orientation tag and to use MakerNote tag instead. Note this information is used to rotate properlly album item thumbs !
This commit fix this problem with Dynax 7D and 5D cameras. Other minolta Camera settings need to be decrypted (under Exiv2 implementation) to improve this way. Since i'm also an Exiv2 developer, i can fix easily the implementation, but i need a feedback from Minolta users for that (reverse engeenering into A1, X1, DImage, etc. cameras)
CCMAIL: digikam-devel at kde.org
M +54 -5 dmetadata.cpp
--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #545148:545149
@@ -497,15 +497,64 @@
return ORIENTATION_UNSPECIFIED;
try
- {
- Exiv2::ExifKey key("Exif.Image.Orientation");
+ {
Exiv2::ExifData exifData(d->exifMetadata);
- Exiv2::ExifData::iterator it = exifData.findKey(key);
+ Exiv2::ExifData::iterator it;
+ long orientation;
+ ImageOrientation imageOrient = ORIENTATION_NORMAL;
+
+ // Because some camera set a wrong standard exif orientation tag,
+ // We need to check makernote tags in first!
+
+ // -- Minolta Cameras ----------------------------------
+
+ Exiv2::ExifKey minoltaKey1("Exif.MinoltaCs7D.Rotation");
+ it = exifData.findKey(minoltaKey1);
if (it != exifData.end())
{
- long orientation = it->toLong();
- kdDebug() << " Exif Orientation: " << orientation << endl;
+ orientation = it->toLong();
+ kdDebug() << "Minolta Makernote Orientation: " << orientation << endl;
+ switch(orientation)
+ {
+ case 76:
+ imageOrient = ORIENTATION_ROT_90;
+ break;
+ case 82:
+ imageOrient = ORIENTATION_ROT_270;
+ break;
+ }
+ return imageOrient;
+ }
+
+ Exiv2::ExifKey minoltaKey2("Exif.MinoltaCs5D.Rotation");
+ it = exifData.findKey(minoltaKey2);
+
+ if (it != exifData.end())
+ {
+ orientation = it->toLong();
+ kdDebug() << "Minolta Makernote Orientation: " << orientation << endl;
+ switch(orientation)
+ {
+ case 76:
+ imageOrient = ORIENTATION_ROT_90;
+ break;
+ case 82:
+ imageOrient = ORIENTATION_ROT_270;
+ break;
+ }
+ return imageOrient;
+ }
+
+ // -- Standard Exif tag --------------------------------
+
+ Exiv2::ExifKey keyStd("Exif.Image.Orientation");
+ it = exifData.findKey(keyStd);
+
+ if (it != exifData.end())
+ {
+ orientation = it->toLong();
+ kdDebug() << "Exif Orientation: " << orientation << endl;
return (ImageOrientation)orientation;
}
}
More information about the Digikam-devel
mailing list