[Digikam-devel] [Bug 131603] Orientation of RAW-images (especially Canons *.cr2)
Marcel Wiesweg
marcel.wiesweg at gmx.de
Mon Jul 31 22:22:33 BST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=131603
------- Additional Comments From marcel.wiesweg gmx de 2006-07-31 23:22 -------
SVN commit 568344 by mwiesweg:
Older Exiv2 versions throw an error when they encounter Minolta Makernote key names.
Only query these keys if they are supported by Exiv2.
Otherwise, the Exif.Image.Orientation tag will be ignored as well.
CCBUGS: 131532, 131603
M +50 -34 dmetadata.cpp
--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #568343:568344
@ -550,8 +550,21 @
if (d->exifMetadata.empty())
return ORIENTATION_UNSPECIFIED;
+ // Workaround for older Exiv2 versions which do not support
+ // Minolta Makernotes and throw an error for such keys.
+ bool supportMinolta = true;
try
- {
+ {
+ Exiv2::ExifKey minoltaKey1("Exif.MinoltaCs7D.Rotation");
+ Exiv2::ExifKey minoltaKey2("Exif.MinoltaCs5D.Rotation");
+ }
+ catch( Exiv2::Error &e )
+ {
+ supportMinolta = false;
+ }
+
+ try
+ {
Exiv2::ExifData exifData(d->exifMetadata);
Exiv2::ExifData::iterator it;
long orientation;
@ -562,49 +575,52 @
// -- Minolta Cameras ----------------------------------
- Exiv2::ExifKey minoltaKey1("Exif.MinoltaCs7D.Rotation");
- it = exifData.findKey(minoltaKey1);
-
- if (it != exifData.end())
+ if (supportMinolta)
{
- orientation = it->toLong();
- kdDebug() << "Minolta Makernote Orientation: " << orientation << endl;
- switch(orientation)
+ Exiv2::ExifKey minoltaKey1("Exif.MinoltaCs7D.Rotation");
+ it = exifData.findKey(minoltaKey1);
+
+ if (it != exifData.end())
{
- case 76:
- imageOrient = ORIENTATION_ROT_90;
- break;
- case 82:
- imageOrient = ORIENTATION_ROT_270;
- break;
+ 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;
}
- 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)
+ Exiv2::ExifKey minoltaKey2("Exif.MinoltaCs5D.Rotation");
+ it = exifData.findKey(minoltaKey2);
+
+ if (it != exifData.end())
{
- case 76:
- imageOrient = ORIENTATION_ROT_90;
- break;
- case 82:
- imageOrient = ORIENTATION_ROT_270;
- break;
+ 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;
}
- return imageOrient;
}
// -- Standard Exif tag --------------------------------
Exiv2::ExifKey keyStd("Exif.Image.Orientation");
it = exifData.findKey(keyStd);
-
+
if (it != exifData.end())
{
orientation = it->toLong();
@ -617,8 +633,8 @
kdDebug() << "Cannot parse Exif Orientation tag using Exiv2 ("
<< QString::fromLocal8Bit(e.what().c_str())
<< ")" << endl;
- }
-
+ }
+
return ORIENTATION_UNSPECIFIED;
}
More information about the Digikam-devel
mailing list