Bug 137750 - color mode2 nikon d70s not recognized as adobe rgb
Summary: color mode2 nikon d70s not recognized as adobe rgb
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ColorManagement-Profiles (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-23 00:24 UTC by Caspar Maessen
Modified: 2022-02-01 11:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.5.0


Attachments
Foto made with nikon d70s color mode2 (adobe rgb) (492.15 KB, image/jpeg)
2006-11-23 00:36 UTC, Caspar Maessen
Details
Image Properties (44.29 KB, image/png)
2006-11-23 22:02 UTC, Caspar Maessen
Details
EXIF Metadata (25.66 KB, image/png)
2006-11-23 22:03 UTC, Caspar Maessen
Details
Makernote Metadata (25.07 KB, image/png)
2006-11-23 22:03 UTC, Caspar Maessen
Details
Nikon manual page (83.72 KB, image/png)
2006-11-23 22:04 UTC, Caspar Maessen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caspar Maessen 2006-11-23 00:24:48 UTC
Version:           svn-605697 (using KDE 3.5.5 "release 39.1" , openSUSE )
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.16.21-0.25-smp

The color mode setting for the nikon d70s mode2 isn't recognized by digiKam.This means that in colormanagement for every photo being opened in the editor the question is asked if the default profile has to be applied. I'll add a photo for you to do some tests on.

Caspar.
Comment 1 Caspar Maessen 2006-11-23 00:36:56 UTC
Created attachment 18659 [details]
Foto made with nikon d70s color mode2 (adobe rgb)
Comment 2 caulier.gilles 2006-11-23 08:11:27 UTC
Caspar,

Thanks for this report.But "ColorMode" is not the right tag to use, but "ColorSpace". Look here :

http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html

This tag have 1=sRGB, 2=AdobeRGB.

Let's me explain the status of NIKON makernote decoding with Exiv2:

- Current Exiv2 0.11 do not know ColorMode tag.

- Next Exiv2 0.12 do not yet know this tag. it's a bugfix release planed at soon (normally this week end)

- Exiv2 0.13 will know this tag, because i have backported current NIKON makernote from ExifTool to Exiv2. This implementation of Exiv2 is in a separate svn branch of repository named 'gettext'. It support NLS ! Look my commit here:

http://dev.robotbattle.com/cmtinfo_svn.php?r=10&l=50&v=973

This Exiv2 0.13 version will be release just later 0.12, normally at Christmast, like digiKam 0.9.0 final. You can test current implementation of Exiv2 'gettext' branch to checkout source code like this :

# svn checkout svn://dev.robotbattle.com/exiv2/branches/gettext

Uninstall old Exiv2 release on your computer before to install gettext branch version. Clean up digiKam and kipi-plugins source code and recompile/re-install all.

To resume : yes digiKam will support Nikon ColorSpace makernote tag when Exiv2 0.13 will be released and it will do for digiKam 0.9.0 final.

Gilles Caulier

Gilles

Comment 3 Caspar Maessen 2006-11-23 19:01:18 UTC
Op donderdag 23 november 2006 08:11, schreef Gilles Caulier:
  > To resume : yes digiKam will support Nikon ColorSpace makernote tag
  > when Exiv2 0.13 will be released and it will do for digiKam 0.9.0
  > final.

OK, thanks. I'll give it a try and report back to you.

Caspar.
Comment 4 Caspar Maessen 2006-11-23 22:01:10 UTC
Op donderdag 23 november 2006 19:01, schreef Caspar Maessen:
  > OK, thanks. I'll give it a try and report back to you.

No luck. checked out the gettext branch of svn-version 991 of exiv2, and 
libs svn-version 607238 and graphics svn-version 607238.
I added 3 snapshots of parts of the digiKam-window. They show 
that "colormode" is unavailable (image properties), "Color Space" is 
Uncalibrated (EXIF Metadata) and "Color Mode" is MODE2 (Makernote 
Metadata). 
I added a fourth snapshot that shows the 3 color modes of the nikon 
d70s, and the fact that color mode 2 stands for Adobe RGB, and the 
modes 1a and 3a for sRGB.


Caspar.
Comment 5 Caspar Maessen 2006-11-23 22:02:39 UTC
Created attachment 18676 [details]
Image Properties
Comment 6 Caspar Maessen 2006-11-23 22:03:21 UTC
Created attachment 18677 [details]
EXIF Metadata
Comment 7 Caspar Maessen 2006-11-23 22:03:58 UTC
Created attachment 18678 [details]
Makernote Metadata
Comment 8 Caspar Maessen 2006-11-23 22:04:55 UTC
Created attachment 18679 [details]
Nikon manual page
Comment 9 Caspar Maessen 2006-11-29 21:51:05 UTC
Op donderdag 23 november 2006 22:01, schreef Caspar Maessen:
  > No luck. checked out the gettext branch of svn-version 991 of


For the time being I'm making use of a workaround with the exiv2 
commandline tool:
exiv2 -M"set Exif.Photo.ColorSpace Short 2" _dsc*.jpg

This works based on the following information

This is what digiKam expects:
TagName:               Type:     Value:    Translation:
Exif.Nikon3.ColorMode  Ascii  9  MODE1a    MODE1a
Exif.Photo.ColorSpace  Short  1  1         sRGB
Exif.Nikon3.ColorMode  Ascii  9  MODE2     MODE2
Exif.Photo.ColorSpace  Short  1  2         Adobe RGB
Exif.Nikon3.ColorMode  Ascii  9  MODE3a    MODE3a
Exif.Photo.ColorSpace  Short  1  1         sRGB

And this is what it gets:
TagName:               Type:     Value:    Translation:
Exif.Nikon3.ColorMode  Ascii  9  MODE1a    MODE1a
Exif.Photo.ColorSpace  Short  1  1         sRGB
Exif.Nikon3.ColorMode  Ascii  9  MODE2     MODE2
Exif.Photo.ColorSpace  Short  1  65535     Uncalibrated
Exif.Nikon3.ColorMode  Ascii  9  MODE3a    MODE3a
Exif.Photo.ColorSpace  Short  1  1         sRGB

So the MODE2 camera-setting isn't translated correctly. The fix is
that we set Exif.Photo.ColorSpace for every JPG-file with the filename
beginning with an underscore (_dsc*.jpg), defining fotographs
taken in MODE2.

I am creating a script around this, with which I will also fix the 
ISO-tag. For sake of efficiency in my workflow and the need of renaming 
outside digiKam (too many digits in the sequencenumber), I will do 
without the digiKam imagedownload for the time being. So I also need to 
take care of autorotation, for which I'm using exiftran.
Nevertheless, I hope you will solve this matter in due time, because 
this is not an ideal solution.


Caspar.
Comment 10 caulier.gilles 2006-11-29 22:30:11 UTC
Yes, of course Caspar.

Since Exiv2 0.12 is released, and since i have backported a lot of improvement in Nikon makernote on Exiv2 library for the next release, we will take a look about your problem together.

Gilles
Comment 11 Caspar Maessen 2006-11-29 22:45:24 UTC
Op woensdag 29 november 2006 22:30, schreef Gilles Caulier:

  > release, we will take a look about your problem together.

Great. I am looking forward to it.

Caspar.
Comment 12 Arnd Baecker 2007-06-12 20:58:06 UTC
Caspar,

have you tried digikam 0.9.2-beta3 (together with exiv2)?
Maybe this does solve your problem?

Thanks a lot in advance for any update!

Best, 

Arnd
Comment 13 Caspar Maessen 2007-06-12 22:12:12 UTC
Still no luck. 0.9.2-rc1 from svn with exiv2 0.14.0

Caspar.
Comment 14 caulier.gilles 2007-06-13 10:12:59 UTC
SVN commit 674817 by cgilles:

libkexiv2 from KDE3 branch : With Nikon camera, the AdobeRgb user color space is defined to set Exif.Photo.ColorSpace to Uncalibrated and Exif.Nikon3.ColorMode to MODE2.
BUG: 137750


 M  +23 -20    kexiv2.cpp  


--- branches/extragear/kde3/libs/libkexiv2/libkexiv2/kexiv2.cpp #674816:674817
@@ -841,42 +841,45 @@
 
 KExiv2::ImageColorWorkSpace KExiv2::getImageColorWorkSpace() const
 {
-    if (d->exifMetadata.empty())
-        return WORKSPACE_UNSPECIFIED;
-
-    try
-    {    
-        // Try to get Exif.Image tags
-        Exiv2::ExifData exifData(d->exifMetadata);
-        Exiv2::ExifKey key("Exif.Photo.ColorSpace");
-        Exiv2::ExifData::iterator it = exifData.findKey(key);
-       
-        if (it != exifData.end())
+    if (!d->exifMetadata.empty())
+    {        
+        long colorSpace;
+    
+        if (getExifTagLong("Exif.Photo.ColorSpace", colorSpace))
         {
-            switch (it->toLong())
+            switch (colorSpace)
             {
                 case 1:
+                {
                     return WORKSPACE_SRGB;
                     break;
+                }
                 case 2:
+                {
                     return WORKSPACE_ADOBERGB;
                     break;
+                }
                 case 65535:
+                {
+                    // Nikon camera set Exif.Photo.ColorSpace to uncalibrated and 
+                    // Exif.Nikon3.ColorMode to "MODE2" when users work in AdobRGB color space.
+                    if (getExifTagString("Exif.Nikon3.ColorMode").contains("MODE2"))
+                        return WORKSPACE_ADOBERGB;
+    
+                    // TODO : add more Makernote parsing here ...
+    
                     return WORKSPACE_UNCALIBRATED;
                     break;
+                }
                 default:
+                {
                     return WORKSPACE_UNSPECIFIED;
                     break;
+                }
             }
         }
-        
-        // TODO : add here Makernote parsing if necessary.
-    }
-    catch( Exiv2::Error &e )
-    {
-        printExiv2ExceptionError("Cannot parse image color workspace tag using Exiv2 ", e);
-    }        
-    
+    }    
+
     return WORKSPACE_UNSPECIFIED;    
 }
 
Comment 15 caulier.gilles 2007-06-13 10:15:29 UTC
Caspar,

To use it, you need to update libkexiv2 using implementation from svn KDE3 branch.

You need at least Exiv2 0.13.

Gilles
Comment 16 Caspar Maessen 2007-06-13 23:01:40 UTC
Compiled 0.9.3-svn675182.
In the colors sidebar ICC-profile Adobe RGB is recognized.
Metadata sidebar EXIF still gives Uncalibrated for the Color Space.

Why not change the tagvalue of Exif.Photo.ColorSpace from 65535 to 2 (see my earlier comment #9), perhaps making it configurable in Settings under Metadata.
Comment 17 caulier.gilles 2007-08-30 06:38:57 UTC
Caspar,

Because, Standard Exif.Photo.ColorSpace values defined by Exif spec do not include  AdobeRGB. This is why your camera set this value to 65535 == uncalibrated, and set another tags to makernote area. To resume, Exif do not know AdobeRGB.

My camera (Minolta Dynax 5D) work exactly like this...

Gilles Caulier