Bug 96459 - EXIF for RAW camera images
Summary: EXIF for RAW camera images
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Raw (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-06 19:00 UTC by Steve
Modified: 2017-08-13 07:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments
Small program that extracts thumbnail and exif from RAW camera images (22.42 KB, text/x-csrc)
2005-01-06 19:04 UTC, Steve
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve 2005-01-06 19:00:02 UTC
Version:           7.1 (using KDE KDE 3.3.2)
Installed from:    SuSE RPMs
OS:                Linux

RAW camera formats tend to be TIFF formats, and contain accessible thumbnails and EXIF data. Using the parse.c you would be able to obtain thumbnails /much/ quicker than using dcraw, and get the exif information as well.
Comment 1 Steve 2005-01-06 19:01:50 UTC
Sorry, should have mentioned that parse.c is also from Dave Coffin, like the dcraw.
Comment 2 Steve 2005-01-06 19:04:16 UTC
Created attachment 8953 [details]
Small program that extracts thumbnail and exif from RAW camera images

Also on Dave Coffin's site, but I've attached it for convenience
Comment 3 Steve 2005-01-06 19:19:01 UTC
One final reason why this would be neat: Fuji RAW formats store the image at 45 degree angle, and currently this is how RAW thumbnails display, which looks a bit strange. If you used parse.c, the builtin thumbnails are already rotated to the normal angle.
Comment 4 Renchi Raju 2005-01-06 22:13:17 UTC
CVS commit by pahlibar: 


partial fix for #96459. try parse.c from dave coffin before trying dcraw to
see if we can actually extract the thumbnail from the images. the speed
difference doesn't seem too substantial though
CCBUG: 96459


  A            parse.c   1.1 [UNKNOWN]
  M +2 -1      Makefile.am   1.13
  M +32 -7     digikamthumbnail.cpp   1.14


--- kdeextragear-3/digikam/kioslave/Makefile.am  #1.12:1.13
@@ -1,9 +1,10 @@
 INCLUDES    = $(IMLIB2_CFLAGS) $(LIBKEXIF_CFLAGS) -I$(top_srcdir)/digikam/sqlite $(all_includes) 
 METASOURCES = AUTO  
+KDE_CFLAGS =  -w
 
 kde_module_LTLIBRARIES = kio_digikamthumbnail.la kio_digikamtags.la \
                          kio_digikamio.la
 
-kio_digikamthumbnail_la_SOURCES = digikamthumbnail.cpp
+kio_digikamthumbnail_la_SOURCES = digikamthumbnail.cpp parse.c
 kio_digikamthumbnail_la_LIBADD = $(LIB_KIO) -ljpeg $(LIBPNG) 
 kio_digikamthumbnail_la_LDFLAGS = -module -avoid-version $(all_libraries) \

--- kdeextragear-3/digikam/kioslave/digikamthumbnail.cpp  #1.13:1.14
@@ -73,4 +73,8 @@ extern "C"
 using namespace KIO;
 
+extern "C"
+{
+int dcraw_identify(const char* infile, const char* outfile);
+}
 
 static void exifRotate(const QString& filePath, QImage& thumb)
@@ -312,6 +316,11 @@ void kio_digikamthumbnailProtocol::get(c
     // stat the original file
     struct stat st;
-    if (::stat(QFile::encodeName(url.path(-1)), &st) == 0)
+    if (::stat(QFile::encodeName(url.path(-1)), &st) != 0)
     {
+        error(KIO::ERR_INTERNAL, i18n("File doesnot exist"));
+        return;
+    }
+
+    
         img = loadPNG(thumbPath);
         if (!img.isNull())
@@ -320,5 +329,4 @@ void kio_digikamthumbnailProtocol::get(c
                 regenerate = false;
         }
-    }
 
     if (regenerate)
@@ -564,4 +572,21 @@ bool kio_digikamthumbnailProtocol::loadI
 bool kio_digikamthumbnailProtocol::loadDCRAW(QImage& image, const QString& path)
 {
+    // first try with Dave Coffin's "parse" utility
+
+    kdDebug() << k_funcinfo << "Parsing file: " << path << endl;
+
+    KTempFile thumbFile(QString::null, "rawthumb");
+    thumbFile.setAutoDelete(true);
+    if (thumbFile.status() == 0)
+    {
+        if (dcraw_identify(QFile::encodeName(path),
+                           QFile::encodeName(thumbFile.name())) == 0)
+        {
+            image.load(thumbFile.name());
+            if (!image.isNull())
+                return true;
+        }
+    }
+    
     QCString command;
 


Comment 5 Renchi Raju 2005-01-06 22:15:41 UTC
the exif handling is done outside digiKam using libkexif/libexif. That part will undergo some changes in the near future and i will try and see if parse.c can't be included in that.
Comment 6 lan 2005-03-11 04:39:29 UTC
I also would like to see ability to view EXIF info for RAW files.
Comment 7 Mike Rosseel 2005-06-05 01:10:33 UTC
additional comment: watch out with Nikon NEF files, the tiff thumbnail is tiny (160x120) so for NEF it may be better to do a dcraw convert instead.

I'm using digikam 0.7.2 and the preview and showfoto both use the tiny thumbnail.

PS: my installation is broken (dcraw not found when doing a raw convert), maybe the behaviour I'm seeing is atypical. Mail me for example NEF files if needed.
Comment 8 Renchi Raju 2005-06-21 20:36:47 UTC
renaming 
Comment 9 Renchi Raju 2005-06-21 20:37:36 UTC
*** Bug 101281 has been marked as a duplicate of this bug. ***
Comment 10 Dennis Gnad 2005-10-15 13:44:38 UTC
I'm also having that problem with *.NEF files - I just have the 160x120 pixel thumbnail .. but dcraw is working without flaws

you could also ask me if NEF files are needed
Comment 11 Gerhard Kulzer 2005-12-18 09:13:59 UTC
*** This bug has been confirmed by popular vote. ***
Comment 12 caulier.gilles 2006-03-03 10:59:56 UTC
SVN commit 515268 by cgilles:

digikam from trunk : Metadata support using Exiv2 :

- New image properties sidebar tab named "Metadata" instead old "Exif". This area include :

* Standard Exif tags viewer.
* MarkerNote Exif tags viewer.
* IPTC records viewer.

- New capability to copy metadata in clipboard like text.
- New capability to print metadata.
- Tags name use the "user Friendly" conversion from Exiv2 instead the internal name provided by old Exif viewer based on libkexif.
- Capability to read metadata from CRW files (Canon RAW files)
- New class DMetadata to load/save metadata without loading image data. Actually JPEG, CRW, and PNG files are supported. About PNG (Exif and IPTC raw profiles generated by ImageMagick are supported.

To support new file formats (like NEF, MRW, TIFF, DNG, etc), new image file parsers must be added to Exiv2 library.

IMPORTANT: 

- Exiv2 do not support yet gettext for i18n rules. All informations in metadata viewers aren't yet i18n (tags name, tags values, and tags descriptions)
- Any tag names use internal Exiv2 name, not the user friendly text transformations. This point must be fixed in Exiv2 libs.

To 0.9.0, these tools are just metadata readers. Writting capabilities (metadata editors) will added later 0.9.0. The files in B.K.O directly or indirectly relevant of this commits are listed below :

*Pending:

103255
106103
115764
111560

*Partially fixed:

91812
96459
109253
110598
118501         

* To check before closing:

122264

* Fixed (can be closed):

103489
121371
105670
109319

CCMAIL: digikam-devel@kde.org,  Andreas Huggel <ahuggel@gmx.net>

CCBUGS: 103255, 106103, 115764, 111560, 91812, 96459, 109253, 110598, 118501, 122264, 103489, 121371, 105670, 109319


 M  +2 -1      libs/Makefile.am  
 M  +5 -4      libs/dimg/Makefile.am  
 M  +1 -1      libs/dimg/dimg.cpp  
 M  +1 -1      libs/dimg/dimg.h  
 M  +19 -1     libs/dimg/dimgloader.cpp  
 M  +4 -2      libs/dimg/dimgloader.h  
 M  +4 -61     libs/dimg/loaders/jpegloader.cpp  
 M  +5 -29     libs/dimg/loaders/pngloader.cpp  
 M  +2 -1      libs/dimg/loaders/rawloader.cpp  
 A             libs/dmetadata (directory)  
 A             libs/dmetadata/Makefile.am  
 A             libs/dmetadata/dmetadata.cpp   [License: GPL]
 A             libs/dmetadata/dmetadata.h   [License: GPL]
 A             libs/dmetadata/loaders (directory)  
 A             libs/dmetadata/loaders/Makefile.am  
 A             libs/dmetadata/loaders/dmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/dmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/jpegmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/jpegmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/pngmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/pngmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/rawmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/rawmetaloader.h   [License: GPL]
 A             libs/dmetadata/loaders/tiffmetaloader.cpp   [License: GPL]
 A             libs/dmetadata/loaders/tiffmetaloader.h   [License: GPL]
 M  +3 -2      libs/imageproperties/Makefile.am  
 M  +82 -323   libs/imageproperties/imagepropertiesexiftab.cpp  
 M  +12 -25    libs/imageproperties/imagepropertiesexiftab.h  
 M  +19 -18    libs/imageproperties/imagepropertiessidebar.cpp  
 M  +10 -9     libs/imageproperties/imagepropertiessidebar.h  
 M  +27 -26    libs/imageproperties/imagepropertiessidebarcamgui.cpp  
 M  +2 -1      libs/imageproperties/imagepropertiessidebarcamgui.h  
 M  +16 -15    libs/imageproperties/imagepropertiessidebardb.cpp  
 M  +3 -1      libs/widgets/Makefile.am  
 A             libs/widgets/metadata (directory)  
 A             libs/widgets/metadata/Makefile.am  
 A             libs/widgets/metadata/exifwidget.cpp   [License: GPL]
 A             libs/widgets/metadata/exifwidget.h   [License: GPL]
 A             libs/widgets/metadata/iptcwidget.cpp   [License: GPL]
 A             libs/widgets/metadata/iptcwidget.h   [License: GPL]
 A             libs/widgets/metadata/makernotewidget.cpp   [License: GPL]
 A             libs/widgets/metadata/makernotewidget.h   [License: GPL]
 A             libs/widgets/metadata/mdkeylistviewitem.cpp   [License: GPL]
 A             libs/widgets/metadata/mdkeylistviewitem.h   [License: GPL]
 A             libs/widgets/metadata/metadatalistview.cpp   [License: GPL]
 A             libs/widgets/metadata/metadatalistview.h   [License: GPL]
 A             libs/widgets/metadata/metadatalistviewitem.cpp   [License: GPL]
 A             libs/widgets/metadata/metadatalistviewitem.h   [License: GPL]
 A             libs/widgets/metadata/metadatawidget.cpp   [License: GPL]
 A             libs/widgets/metadata/metadatawidget.h   [License: GPL]
 M  +24 -1     utilities/cameragui/cameraui.cpp  
Comment 13 F.J. Cruz 2006-03-03 12:56:06 UTC
---- Gilles Caulier <caulier.gilles@free.fr> escribió: 
[bugs.kde.org quoted mail]

Actually, I'm in contact with Exiv2 developer to try to implement myself support for NEF files. If somebody can/want to help, please drop me an email.

Paco Cruz
Comment 14 caulier.gilles 2006-03-03 13:33:34 UTC
Paco, this link can help you in your task :

http://www.rags-int-inc.com/PhotoTechStuff/RawStandards/RawSummary.html

Gilles
Comment 15 Duncan Hill 2006-04-17 16:35:43 UTC
I think I'm affected by the 0.9 switch to Exiv2 - the MRW files I'm working with aren't producing accurate information when queried by digiKam.

http://www.cricalix.net/~dhill/digikam/PICT2698.MRW.gz

DiMAGE Master tells me that this image has the following meta-data:
Shutter speed: 1/60
Aperture: 3.5
Flash: Yes (fill flash)
ISO: 200
Lens focal length: 18mm
Equivalent length: 27mm
Brightness: 3.6

digiKam says:
Shutter: 1/1000
Aperture: 4.5
Flash: No
ISO: 200
Focal length: 26mm
Equivalent: 39mm
Brightness: 8.62

Makernotes don't even show up :(

The focal length is a simple calculation issue.  The rest I can only assume is Exiv2 mis-reading the RAW data, or digiKam misreading the output from Exiv2.

One neat bit of makernote that dimage can pick up is the lens that was used.  It'd be so sweet if digiKam could do that.
Comment 16 Duncan Hill 2006-04-17 16:39:58 UTC
If I recall correctly, one of the posters on the digiKam list had a tool that could extract the RAW data from most cameras - perhaps they need to talk to the Exiv2 folks, and pool talent and resources to provide one powerful library.
Comment 17 caulier.gilles 2006-04-17 21:33:38 UTC
Ducan, 

If you try the last Exiv2 source code (under developement from Exiv2 svn repository), there is a new TIFF/EP file parser to get Exif/IPTC/GPS info from all TIFF/EP files based (this include NEF, DNG, CR2, PEF, etc)... 

But this is not included MRW file because it's not a TIFF/EP file based.

Later digiKam 0.9.0-beta1, i will working on Exiv2 project to add MRW support and Minolta makernotes. Please let's me any time (:=)))...

Gilles Caulier
Comment 18 Gerhard Kulzer 2006-04-18 10:54:57 UTC
I just did that (checkout latest exiv2) and found that the configure script is missing from the svn account. So ./config will not work.
Workaround: You can extract it from the tar ball.
Comment 19 Duncan Hill 2006-04-18 14:54:24 UTC
Thanks for the info Gilles.  I'm running digiKam SVN as production now (yes, I'm slightly nuts), so SVN of a dependency can't hurt :)
Comment 20 Andreas Huggel 2006-04-18 15:34:17 UTC
There is no configure script in the Exiv2 SVN repository as this is a generated script. Run 'make config' after checking out the source to generate it and read the README.
Comment 21 Gerhard Kulzer 2006-04-18 16:28:58 UTC
Ok, good to learn!
But the README in svn file says to run
./configure && make && make install
Comment 22 Andreas Huggel 2006-04-18 19:33:00 UTC
Yes, that refers to the distributed tarball. Read on... 
In the meantime I'll try to re-word this so that it'll be clearer
Comment 23 caulier.gilles 2006-05-10 23:07:22 UTC
SVN commit 539531 by cgilles:

digikam from trunk : DMetadata MRW Raw file parser : add standard Minolta MakerNote support. Still todo Camera Settings. This code require last Exiv2 implementation from svn (future 0.9.2 Exiv2 release including my Minolta makernote parser implementation)

CCMAIL: digikam-devel@kde.org
CCBUGS: 96459

 M  +209 -251  mrwparser.cpp  
Comment 24 caulier.gilles 2006-05-11 09:03:58 UTC
SVN commit 539610 by cgilles:

digikam from trunk : DMetadata::MRWparser: 

- support Dynax 5D camera settings makernote.
- Fix memory leak (thanks mr valgrind)
- added Exception rules to prevent crash if old Exiv2 release is used.

CCBUGS: 96459

 M  +222 -97   mrwparser.cpp  
Comment 25 caulier.gilles 2006-05-11 09:51:58 UTC
SVN commit 539614 by cgilles:

digikam from trunk : DMetadata::MRWparser: 

- support Dynax 7D camera settings makernote.
- added Exception rules to prevent crash if old Exiv2 release is used (Again).

CCBUGS: 96459

 M  +401 -271  mrwparser.cpp  
Comment 26 caulier.gilles 2006-05-11 11:47:04 UTC
SVN commit 539629 by cgilles:

digikam from trunk : DMetadata::MRWparser: 

- support Sandard NEW camera settings makernote (like D5, D7, S304, and S404 camera).
- support Sandard OLD camera settings makernote (like D7u, D7i, and D7hi camera).

CCBUGS: 96459

 M  +298 -16   mrwparser.cpp  
 M  +15 -13    mrwparser.h  
Comment 27 caulier.gilles 2006-05-23 21:55:14 UTC
SVN commit 544159 by cgilles:

digikam from trunk : bye bye MRW parser from digiKam core, Welcome to  MRW parser from Exiv2 (0.10 release) !!!

To resume: Exif/Makernote from RAW file formats are now extracted in digiKam using Exiv2 library (http://www.exiv2.org). Next release planed in a near future, will support (in read only) these RAW file formats:

Adobe DNG, 
Canon CR2,
Canon CRW, 
Nikon NEF, 
Pentax PEF, 
Sony SR2,
Minolta MRW

New RAW file formats will be added in the future, like X3F, ORF, RAF... 

Developpers : all contributions welcome to improve this great library ! 

I can close bug #96459 now.

BUG: 96459
CCMAIL: digikam-devel@kde.org, ahuggel@gmx.net

 M  +1 -1      Makefile.am  
 D             mrwparser.cpp  
 D             mrwparser.h  
 M  +2 -12     rawmetaloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dmetadata/loaders/Makefile.am #544158:544159
@@ -4,7 +4,7 @@
 noinst_LTLIBRARIES = libdmetadataloader.la
 
 libdmetadataloader_la_SOURCES = dmetaloader.cpp jpegmetaloader.cpp pngmetaloader.cpp tiffmetaloader.cpp \
-	                        rawmetaloader.cpp mrwparser.cpp 
+	                        rawmetaloader.cpp 
 
 libdmetadataloader_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIBJPEG) $(LIB_TIFF) $(LIB_PNG)
 
--- trunk/extragear/graphics/digikam/libs/dmetadata/loaders/rawmetaloader.cpp #544158:544159
@@ -24,7 +24,6 @@
 
 // Local includes.
 
-#include "mrwparser.h"
 #include "rawmetaloader.h"
 
 namespace Digikam
@@ -42,28 +41,19 @@
 bool RAWMetaLoader::load(const QString& filePath)
 {
     // In first we trying to use Exiv2 library
+    // Exiv2 0.10 support : DNG, CRW, CR2, NEF, PEF, MRW, SR2
     if (loadWithExiv2(filePath))
         return true;
 
-    // Try to parse MRW RAW file
-    
-    MRWParser mrwparser;
-    if (mrwparser.parseMRW(QFile::encodeName(filePath)))
-    {
-        exifMetadata() = mrwparser.getExif();
-        return true;
-    }
-        
+    // TODO new experimental RAW parser can be added here.
     return false;
 }
 
 bool RAWMetaLoader::save(const QString& filePath)
 {
-    // In first we trying to use Exiv2 library
     if (saveWithExiv2(filePath))
         return true;
         
-    // TODO
     return false;
 }