[Kde-imaging] [Bug 144604] Rotation causes Exif data corruption

Andreas Huggel ahuggel at gmx.net
Sat Apr 28 04:37:08 CEST 2007


------- 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=144604         




------- Additional Comments From ahuggel gmx net  2007-04-28 04:37 -------
Gilles,

Try this patch (against a recent pre-release of libkexiv2). It compiles but is untested (I don' have the complete digikam devel environment here at the moment):

--- kexiv2.cpp-0.1.2    2007-04-28 10:16:07.000000000 +0800
+++ kexiv2.cpp  2007-04-28 10:25:14.000000000 +0800
 @ -1570,11 +1570,9  @
         d->exifMetadata.add(Exiv2::ExifKey("Exif.GPSInfo.GPSAltitudeRef"), value.get());

         // And the actual altitude.
-        value = Exiv2::Value::create(Exiv2::signedRational);
         convertToRational(altitude, &nom, &denom, 4);
         snprintf(scratchBuf, 100, "%ld/%ld", nom, denom);
-        value->read(scratchBuf);
-        d->exifMetadata.add(Exiv2::ExifKey("Exif.GPSInfo.GPSAltitude"), value.get());
+        d->exifMetadata["Exif.GPSInfo.GPSAltitude"] = scratchBuf;

         // LATTITUDE
         // Latitude reference: "N" or "S".
 @ -1606,12 +1604,10  @
         // Further note: original code did not translate between
         //   dd.dddddd to dd mm.mm - that's why we now multiply
         //   by 6000 - x60 to get minutes, x1000000 to get to mmmm/1000000.
-        value = Exiv2::Value::create(Exiv2::signedRational);
         deg   = (int)floor(fabs(latitude)); // Slice off after decimal.
         min   = (int)floor((fabs(latitude) - floor(fabs(latitude))) * 60000000);
         snprintf(scratchBuf, 100, "%ld/1 %ld/1000000 0/1", deg, min);
-        value->read(scratchBuf);
-        d->exifMetadata.add(Exiv2::ExifKey("Exif.GPSInfo.GPSLatitude"), value.get());
+        d->exifMetadata["Exif.GPSInfo.GPSLatitude"] = scratchBuf;

         // LONGITUDE
         // Longitude reference: "E" or "W".
 @ -1643,12 +1639,10  @
         // Further note: original code did not translate between
         //   dd.dddddd to dd mm.mm - that's why we now multiply
         //   by 6000 - x60 to get minutes, x1000000 to get to mmmm/1000000.
-        value = Exiv2::Value::create(Exiv2::signedRational);
         deg   = (int)floor(fabs(longitude)); // Slice off after decimal.
         min   = (int)floor((fabs(longitude) - floor(fabs(longitude))) * 60000000);
         snprintf(scratchBuf, 100, "%ld/1 %ld/1000000 0/1", deg, min);
-        value->read(scratchBuf);
-        d->exifMetadata.add(Exiv2::ExifKey("Exif.GPSInfo.GPSLongitude"), value.get());
+        d->exifMetadata["Exif.GPSInfo.GPSLongitude"] = scratchBuf;

         return true;
     }


More information about the Kde-imaging mailing list