[Digikam-devel] extragear/graphics/digikam/libs/dmetadata/loaders

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] extragear/graphics/digikam/libs/dmetadata/loaders

Gilles Caulier
SVN commit 546183 by cgilles:

digikam from trunk : DMetadata::PNGMetaLoader : backport cameragui method to get Exif metadata from APP1 byte array generated by ImageMagick into a raw text profile. This way is more generic and work fine with Exif raw profile.
CCMAIL: [hidden email]

 M  +16 -2     pngmetaloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dmetadata/loaders/pngmetaloader.cpp #546182:546183
@@ -88,8 +88,22 @@
                     uchar *data = readRawProfile(s.ascii(), &length);
                     if (!data)
                         continue;
-                    // We removing standard Exif header
-                    exifMetadata().load((const Exiv2::byte*)data+6, length-6);
+                    
+                    char exifHeader[] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 };
+                    QByteArray exifData(length);
+                    memcpy(exifData.data(), data, length);
+                    
+                    if (!exifData.isEmpty())
+                    {                    
+                        int i = exifData.find(*exifHeader);
+                        if (i != -1)
+                        {
+                            kdDebug() << filePath << " : Exif header found at position " << i << endl;
+                            i = i + sizeof(exifHeader);
+                            exifMetadata().load((const Exiv2::byte*)data+i, exifData.size()-i);
+                        }
+                    }
+                    
                     delete [] data;
                     
                     if (!exifMetadata().empty())
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel