Bug 195050 - Color management doesn't work in thumbnails and view mode
Summary: Color management doesn't work in thumbnails and view mode
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ColorManagement-Views (show other bugs)
Version: 0.10.0
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-03 02:12 UTC by Michal Thoma
Modified: 2022-02-01 11:31 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0
Sentry Crash Report:


Attachments
Output of exiftool for several different Nikon image files (7.59 KB, application/octet-stream)
2009-09-01 09:27 UTC, Matti Rintala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Thoma 2009-06-03 02:12:42 UTC
Version:           0.10 (using KDE 4.2.2)
OS:                Linux
Installed from:    Debian stable Packages

I set up color management though in thumbnail and view mode there is no change, images are still displayed as in color management unaware application. Only in edit mode color management is employed. It's not only RAW images, but TIFFs and JPEGs with valid profiles.

It also seems there is some confusing informations in Digikam documentation where in the section "ICC Profiles setup"  is written: "The Use color managed view is an alternative to using Xcalib or Argyll. Only your image will be color managed, not your entire screen!"

Xcalib and Argyll's dyspwin are application which sets up video adapter gamma tables and this Digikam definitely doesn't do. One would expect that it just translate image color space to monitor color space so that will be displayed with highest possible accuracy. This is no way altering XCalib or Dispwin. Anyway setting up "Use color managed view" doesn't make any change to thumbnail and view mode, only applies in edit.
Comment 1 Matti Rintala 2009-06-12 20:31:00 UTC
The same bug/problem still exists in 1.0.0 beta 1 (tested on OpenSuse 11.1 64-bit, compiled form source). In normal viewing mode color management is not used and color profile settings are ignored.
Comment 2 Marcel Wiesweg 2009-08-23 20:42:36 UTC
SVN commit 1014769 by mwiesweg:

Enabling color management for previews.
The transform is applied once in the thread, so there is no speed problem
like for color managed view in the editor.
Add support to set a displaying widget for a PreviewLoadThread.

CCBUG: 195050

 M  +1 -1      loadsavetask.cpp  
 M  +11 -0     previewloadthread.cpp  
 M  +7 -0      previewloadthread.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1014769
Comment 3 Marcel Wiesweg 2009-08-23 20:42:53 UTC
SVN commit 1014770 by mwiesweg:

Enable color management for thumbnails.
The transformation is done on the final scaled QImage when creating a thumbnail
if an embedded ICC profile was read before. Applying to a very small image is is very fast.
We then store and display the thumbnails as sRGB.
There is so much quality loss already in a thumbnail that the little imperfection of ignoring the monitor
profile should be ok.

CCBUG: 195050

 M  +25 -13    thumbnailcreator.cpp  
 M  +2 -1      thumbnailcreator.h  
 M  +12 -4     thumbnailloadthread.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1014770
Comment 4 Marcel Wiesweg 2009-08-23 20:43:17 UTC
SVN commit 1014771 by mwiesweg:

Set displaying widgets to retrieve monitor profile, if set, to preview views.

BUG: 195050

 M  +2 -1      NEWS  
 M  +2 -0      digikam/imagepreviewview.cpp  
 M  +2 -1      utilities/batch/fingerprintsgenerator.cpp  
 M  +2 -0      utilities/lighttable/lighttablepreview.cpp  
 M  +2 -0      utilities/slideshow/slideshow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1014771
Comment 5 Matti Rintala 2009-08-24 10:56:05 UTC
Thanks Marcel for working on this bug! It's much appreciatated :-)

However, I hope you could change your fix to apply the display profile to thumbnails too, if colour management is enabled. You said "There is so much quality loss already in a thumbnail that the little imperfection of ignoring the monitor profile should be ok".

However, many new displays are wide gamut displays whose native colour space is *far* from sRGB (most new 24" and larger lcds are wide gamut now, and their prices are dropping fast). On those displays converting to sRGB and ignoring the display profile ensures that the thumbnail looks terrible!

So, I would ask you to consider reopening this bug. Wide gamut displays are becoming the norm with photo enthusiasts, so for thumbnails the current fix does not solve the problems in the long run. If full color management of thumbnails is considered too slow, I suggest either reverting the patch for thumbnails completely, or introducing a new user preference.

Matti Rintala
Comment 6 caulier.gilles 2009-08-24 11:20:03 UTC
Marcel,

Matti reflexion is right. I vote for a user settings to turn on/off thumbnails CM.

Gilles Caulier
Comment 7 Marcel Wiesweg 2009-08-24 18:49:41 UTC
I will add a user preference. This adds a bit of overhead, maybe not too much, but I'm not sure.
Comment 8 Marcel Wiesweg 2009-08-24 19:40:36 UTC
Matti talked about displaying, which is all right; I also talked about storage - so do you agree that we _store_ the thumbnails files (in the thumbnail db) in sRGB?
Converting to monitor profile is done when loading the precreated thumbnail.
Comment 9 Matti Rintala 2009-08-24 19:53:43 UTC
(In reply to comment #8)
> Matti talked about displaying, which is all right; I also talked about storage
> - so do you agree that we _store_ the thumbnails files (in the thumbnail db) in
> sRGB?
> Converting to monitor profile is done when loading the precreated thumbnail.

I think storing the thumbnails in sRGB is fine, if they are converted to display profile when displayed. The only loss then are the occasional out-of-gamut colors in part of the thumbnail, but as you said, thumbnails are not meant to be critically viewed, anyway.

I understand that you don't want to store the thumbnails in their original colour space, as that would imply storing their colour profiles as well.
Comment 10 Michal Thoma 2009-08-24 19:58:59 UTC
I think storing thumbnails in sRGB is smart! I suggest that conversion to sRGB should happen even with Color Management turned off.
Comment 11 Marcel Wiesweg 2009-08-26 22:18:27 UTC
SVN commit 1016022 by mwiesweg:

Enable color managed display of thumbnails if color management in enabled.
Dedicated setup option comes if profiling shows it has a significant impact,
but I found some issues to sort out in the thumbnail loading before.
Allow to set displaying widget for thumbnail color management.
Extend ThumbnailTask for post processing like the other tasks
(could get some refactoring for code reuse in the future)

CCBUG: 195050

 M  +1 -0      digikam/digikamapp.cpp  
 M  +31 -12    libs/threadimageio/thumbnailloadthread.cpp  
 M  +6 -0      libs/threadimageio/thumbnailloadthread.h  
 M  +51 -15    libs/threadimageio/thumbnailtask.cpp  
 M  +5 -0      libs/threadimageio/thumbnailtask.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1016022
Comment 12 Marcel Wiesweg 2009-08-29 17:00:54 UTC
SVN commit 1017009 by mwiesweg:

Put previews in color managed form into the cache so that preloading is fast.

CCBUG: 195050

 M  +6 -1      previewtask.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1017009
Comment 13 Marcel Wiesweg 2009-08-29 17:01:09 UTC
SVN commit 1017010 by mwiesweg:

Add a settings to enable color managed view for thumbnails and previews

CCBUG: 195050

 M  +3 -0      imageeditor/canvas/iccsettingscontainer.cpp  
 M  +1 -0      imageeditor/canvas/iccsettingscontainer.h  
 M  +15 -5     setup/setupicc.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1017010
Comment 14 Marcel Wiesweg 2009-08-29 17:03:20 UTC
Color managed view is now fully implemented for previews and thumbnails. Please test this functionality with the coming beta4. We can close this bug if no problems are found.
Comment 15 Matti Rintala 2009-08-31 14:54:50 UTC
I compiled beta4 and tried color management. Mostly things seemed ok, so thanks for this improvement!

However, there's one thing that still makes this unusable for me:

It seems Digikam doesn't recognise the (preview) profile of my Nikon NEF raw files. Based on my screen testing it seems that it (wrongly) assumes that my NEF previews are in sRGB profile even though they are in AdobeRGB.

I know that profile information is in the NEF file, since GQView succesfully recognises and uses the profile.
Comment 16 Marcel Wiesweg 2009-08-31 17:47:17 UTC
Matti, can you send me a sample NEF file? (per private mail is ok)
Comment 17 Michal Thoma 2009-08-31 19:58:17 UTC
It definitely works and makes using digikam even greater pleasure!

As I was looking at the thumbnails it seems to me, that these are color managed all the time, even when the color management is turned off. Seems like Color Management settings are ignored for thumbnails (though it works perfectly for view mode).

Maybe there should also be menu switch under View tab (like it's in Editor) to turn color management on or off. Although I don't need this really... Great job anyway, thank you!
Comment 18 Marcel Wiesweg 2009-08-31 20:15:25 UTC
Thumbnail cache is not cleared currently, probably you switched it off and had still the color managed thumbnails from the cache. I did not expect this setting to be changed all too often.
Comment 19 Michal Thoma 2009-08-31 20:25:17 UTC
Oh, so images are stored in monitor color space in cache? This makes sense, right. 

I have one more request. Can we have color management in Slideshow module too? It seems to be last part od digikam which is color management unaware...
Comment 20 Matti Rintala 2009-09-01 09:27:36 UTC
Created attachment 36607 [details]
Output of exiftool for several different Nikon image files

Here are outputs of exiftool for several different Nikon image files:
d300-srgb.nef.txt: Nikon D300 sRGB raw from camera
d300-srgb.jpg.txt: Nikon D300 sRGB JPG from camera
d300-adobergb.nef.txt: Nikon D300 AdobeRGB raw from camera
d300-adobergb.jpg.txt: Nikon D300 AdobeRGB JPG from camera
d300-srgb-to-adobergb.nef.txt: Nikon D300 sRGB raw edited in Capture NX2, stored as AdobeRGB raw
d300-srgb-to-adobergb.jpg.txt: Nikon D300 sRGB raw edited in Capture NX2, stored as AdobeRGB JPG
d40-srgb.nef.txt: Nikon D40 sRGB raw from camera
d40-srgb.jpg.txt: Nikon D40 sRGB JPG from camera
d40-adobergb.nef.txt: Nikon D40 AdobeRGB raw from camera
d40-adobergb.jpg.txt: Nikon D40 AdobeRGB JPG from camera
d40-srgb-to-adobergb.nef.txt: Nikon D40 sRGB raw edited in Capture NX2, stored as AdobeRGB raw
d40-srgb-to-adobergb.jpg.txt: Nikon D40 sRGB raw edited in Capture NX2, stored as AdobeRGB JPG
Comment 21 Matti Rintala 2009-09-01 09:39:55 UTC
Here are come comments concerning the attacment I just created:

I'll send Marcel the actual image files for further study.

I took the same picture with Nikon D40 and D300 with several settings:
- Raw (nef) and jpg
- Camera set up to store image as sRGB and AdobeRGB
- I edited a raw image with Nikon Capture NX2 and stored it both as nef and jpg with AdobeRGB as working space (NX2 embeds an ICC profile by default)

I compiled digikam from svn trunk and tried the files with it. Here are my findings:

For jpg files, Digikam correctly recognised the jpg containing an ICC profile (edited with Capture NX2). It also correctly recognised the exif color space tag in the sRGB jpg. However, it did *not* recognise the AdobeRGB jpg, it gave debug output: "No input profile: invalid Behavior flags 1048576". Looking at exiftool output it seems that for AdobeRGB Nikon sets exif color space to "Uncalibrated" and sets exif Interoperability Index to "R03 AdobeRGB".

For all raw files I got debug output: "No input profile: invalid Behavior flags 1048576". It seems that Digikam did not try to interpret exif color space or interoperability index tags, nor did it recognise the embedded ICC profile in raw file edited with Capture NX2.
Comment 22 Matti Rintala 2009-09-01 17:08:53 UTC
Just a small addition to my findings about Nikon's way to tag colour spaces (this was something I didn't know before):

According to exiftool home page Nikon's practice of using exif Interoperability Index to mark AdobeRGB colour space is correct:

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

ColorSpace
1 = sRGB
2 = Adobe RGB
65535 = Uncalibrated
(the value of 2 is not standard EXIF. Instead, an Adobe RGB image is indicated by "Uncalibrated" with an InteropIndex of "R03")
Comment 23 Milan Knížek 2009-09-01 19:36:45 UTC
(In reply to comment #18)
> Thumbnail cache is not cleared currently, probably you switched it off and had
> still the color managed thumbnails from the cache. I did not expect this
> setting to be changed all too often.

Marcel: what is meant by "cache" - some temporary thing valid only while digiKam is running or the images stored in thumbnail db?

My motivation: I have AdobeRGB display and use it for editing of the "better" pictures. However, I do quite often use it only in the standard sRGB space, since many applications, including the X Window managers, are still not CM-aware and especially the red icons displayed in AdobeRGB make my eyes sore...
Comment 24 Marcel Wiesweg 2009-09-01 20:10:51 UTC
> some temporary thing valid only while digiKam is running

Just that. For thumbnails, we cache the pixmap ready to be drawn (loaded from the thumb db, color managed and converted to pixmap). Pregenerated thumbnails in the db are stored in sRGB.
Reduced size previews are cached as color managed images.
Full sized images are color managed after loading from the cache.
Comment 25 Matti Rintala 2009-09-01 20:36:39 UTC
Marcel,

If thumbnails have been generated before colour management was turned on, then thumbnails in the db are in their original colour space, not sRGB, right? And if colour management is then turned on, they are wrongly assumed to be in sRGB and conversion to display profile produces wrong results? Or are thumbnails in db always colour managed and in sRGB, even if colour management for preview is turned off?

Is there a way to clear thumbnails from the db without completely rebuilding it?
And should users be notified about this when they enable color management for thumbnails?

For example, I'm thinking about AdobeRGB images (which look acceptable without colour management with many wide gamut displays). If they end up in db in AdobeRGB form (colour management off) and are then used as sRGB (colour management turned on), they saturation is way too low.
Comment 26 kde2eran 2009-09-01 21:25:05 UTC
I'm running DigiKam on my laptop, hooked up to different monitors at different times (monitor at home, monitor at office, laptop's LCD). Each monitor has a different gamut and color calibration. I wouldn't want to have to flush the db or thumbnail cache every time I switch monitors...

How expensive is it to keep thumbnails in the original colorspace, and convert them on the fly as done for the full images?

(Right now I need to manually switch the colorspace, but work is under way to have the X server's RandR extension report the monitor's color space, and hopefully DigiKam will use this in the future for automatic switching.)
Comment 27 Milan Knížek 2009-09-02 13:45:06 UTC
(In reply to comment #26)
I wouldn't want to have to flush the db
> or thumbnail cache every time I switch monitors...

As Marcel explained, it should be sufficient to restart digiKam to refresh the colour managed pixmaps in the cache from thumbnails db.
 
> How expensive is it to keep thumbnails in the original colorspace, and convert
> them on the fly as done for the full images?

As discussed above, it seems to be okay to have thumbnails db in sRGB only and create the cached thumbnails as colour managed pixmaps in the colour space of the current monitor.

We would potentially loose some out of gamut colours, but for thumbnails, this should not be a hot issue. (E.g. the original image is ProPhoto RGB, thumbnail is sRGB, monitor is Adobe RGB - the colours of thumbnail would be colour managed for AdobeRGB, but we would loose any colour outside sRGB gamut but within ProPhoto RGB gamut.)
Comment 28 Marcel Wiesweg 2009-09-02 18:58:11 UTC
Matti:

> If thumbnails have been generated before colour management was turned on, then
> thumbnails in the db are in their original colour space, not sRGB, right? And
> if colour management is then turned on, they are wrongly assumed to be in sRGB
> and conversion to display profile produces wrong results? 

Yes, if they have been generated before 1.0-beta4 or if color management (the main option) was turned off.


> Or are thumbnails in
> db always colour managed and in sRGB, even if colour management for preview is
> turned off?

From 1.0-beta4, they are always color managed and in sRGB if color management is turned on, regardless of the settings for color managed view.

> 
> Is there a way to clear thumbnails from the db without completely rebuilding
> it?

rm thumbnails-digikam.db

> And should users be notified about this when they enable color management for
> thumbnails?

If they enable color management, yes maybe...

kde2eran:

> I'm running DigiKam on my laptop, hooked up to different monitors at different
> times (monitor at home, monitor at office, laptop's LCD). Each monitor has a
> different gamut and color calibration. I wouldn't want to have to flush the db
> or thumbnail cache every time I switch monitors...

I will go and implement automatic cache flushing if the monitor profile changes.

> 
> How expensive is it to keep thumbnails in the original colorspace, and convert
> them on the fly as done for the full images?

Pretty unacceptably slow. As explained above, this is not needed. The only complication not covered currently is if someone uses two screens at a time with different profiles. I deliberately decided not to care for this at the moment (it can work for the editor, but is of course not tested.)

> (Right now I need to manually switch the colorspace, but work is under way to
> have the X server's RandR extension report the monitor's color space, and
> hopefully DigiKam will use this in the future for automatic switching.)

Interesting. I am implementing #197817 but I dont know how to detect changes. Worst case is you need to restart the application.
Comment 29 Marcel Wiesweg 2009-09-04 16:42:15 UTC
SVN commit 1019823 by mwiesweg:

Clear image and thumbnail cache if relevant color-managed view options changed

CCBUG: 195050

 M  +19 -0     libs/threadimageio/loadingcache.cpp  
 M  +6 -0      libs/threadimageio/loadingcache.h  
 M  +16 -1     utilities/imageeditor/canvas/iccsettings.cpp  
 M  +1 -0      utilities/imageeditor/canvas/iccsettings.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1019823
Comment 30 Marcel Wiesweg 2009-09-04 17:37:42 UTC
SVN commit 1019840 by mwiesweg:

Interpret the Exif.Iop.InteroperabilityIndex and Exif.Nikon3.ColorSpace
for AdobeRGB images when main color space is set to uncalibrated.

BUG: 191113
CCBUG: 195050


 M  +17 -2     kexiv2image.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1019840
Comment 31 Marcel Wiesweg 2009-09-04 18:10:33 UTC
The AdobeRGB / JPEG issue should be settled.
The NEF issue is different:
1) It seems that the color space tags in the Exif Info of the NEF file apply to the embedded preview, which has no exif information at all.
2) The NX2 edited images RAW images have an actual embedded ICC profile in the RAW file which also obviously applies to the embedded JPEG preview.

Is this NEF-specific? Does anyone know if other RAW formats also specify or even embed color profiles for their embedded previews?
Comment 32 caulier.gilles 2009-09-04 18:18:57 UTC
Marcel, 

Look this Exif tags :

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

0xa001 	ColorSpace 	  int16u
0xc71a 	PreviewColorSpace int32u!

And now Makernotes :

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

0x001e 	ColorSpace 	  int16u

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

0x00b4 	ColorSpace 	  int16u

etc...

...welcome in this big puzzle...

Gilles
Comment 33 Matti Rintala 2009-09-04 18:45:18 UTC
Gilles,

I wouldn't be too worried about the Nikon and Canon specific colour space tags, if Digikam only recognises sRGB and AdobeRGB using those tags. Since standard EXIF specifies how those colour spaces are tagged using ColorSpace and InteroperabilityIndex, Digikam can trust those tags. I think the vendor-specific flags are there in case cameras start using colour spaces not defined by normal EXIF.

It's interesting to notice that there's PreviewColorSpace tag as well! :-)
I would imagine it's safe to trust that for raw files ColorSpace and PreviewColorSpace are equal, since raw files have no native standard colour space.
Comment 34 Matti Rintala 2009-09-04 18:47:58 UTC
I forgot to add that it would be REALLY nice if libexiv2 would provide an API function for returning an colour profile for an image (it could do all the dirty work of reading appropriate tags and deciding which profile to use). :-)
Comment 35 Marcel Wiesweg 2009-09-04 19:42:47 UTC
Gilles: We support the EXIF and Nikon color space already. The Canon tag doesn't seem to be available from libexiv2 (looked in canonmn.cpp).

Matti: There is getImageColorWorkSpace()
Comment 36 caulier.gilles 2009-09-04 20:09:46 UTC
Take a care about JPEG embedded in RAW files and exif data. it's the hell.

To have experimented some problems with rotation tag from my Minolta camera, i have discovered this puzzle : with dcraw, extracted jpeg embedded from raw has exif data, but there are copied from raw part as well. There are not set by camera in jpeg image data.

I checked in pass how dcraw work when jpeg is extracted : it sound like jpeg image is extracted and after to be written to disk, RAW exif are copied to this file as well.

There is a problem here : exif data cannot be exactly the same for both.

Alex can be precise here about this subject...

Gilles
Comment 37 Matti Rintala 2009-09-05 22:25:58 UTC
Marcel,

I'm not sure if this is connected with your recent fixes or not, but currently when I start Digikam compiled from trunk, I notice the following error messages (which do not prevent Digikam from starting, though).

Does this maybe happen because AdobeRGB profile is found several times from my profile directories?

digikam(30649) Digikam::IccSettingsPriv::scanDirectories: ("/usr/share/color/icc", "/home/bitti/.local/share/color/icc/", "/home/bitti/.color/icc/", "/home/bitti/config/color/icc")                                                            
digikam(30649)/digikam (core) Digikam::IccProfile::considerOriginalAdobeRGB: The original Adobe RGB (1998) profile has been found at "/usr/share/color/icc/Adobe ICC Profiles/RGB Profiles/AdobeRGB1998.icc"                                    
digikam(30649)/digikam (core) Digikam::IccProfile::considerOriginalAdobeRGB: The original Adobe RGB (1998) profile has been found at "/home/bitti/.color/icc/AdobeRGB1998.icc"                                                                  
lcms: Error #12288; Corrupted memory profile                                    
digikam(30649)/digikam (core) Digikam::IccProfile::considerOriginalAdobeRGB: The original Adobe RGB (1998) profile has been found at "/home/bitti/config/color/icc/AdobeRGB1998.icc"                                                            
lcms: Error #12288; Corrupted memory profile                                    
Starting to load Plugins.
Comment 38 Marcel Wiesweg 2009-09-07 17:29:01 UTC
Yes it's several times the same file. No need to worry. (We have no license to redistribute it, but if it is found installed, it is detected by MD5 hash)
Comment 39 Matti Rintala 2009-09-08 17:14:22 UTC
Marcel,

I have been thinking about your comment about Nikon NEF files, colour profiles and exif data. First, it's true that the embedded ICC profile in NEF files edited with NX2 is the profile of the embedded full-res jpeg.

This is because in reality, Nikon NEF files are not just "raw sensor data files". To my understanding, Nikon NEF file can contain a source image, transformations applied to it, and then the resulting image (the embedded full-res jpeg). With NEF files straight from camera, source image is the raw sensor data, transformations consist of camera settings in the exif. When a raw image is edited in NX2, additional edit steps are added to the metadata and the embedded jpeg represents the final edited image.

It is even possible to edit a jpeg in Capture NX2 and store the result as a NEF file! Then the source image is the original jpeg (stored inside the NEF file), and file metadata contains all edit steps performed. The embedded jpeg "preview" is the final edited jpeg.

And since you can choose the working colour space freely in NX2 (and change the colour space as an edit step), the ICC profile in the NEF file is that of the final image, i.e. the embedded jpeg.

For this reason the embedded jpeg is so important for Nikon NEF shooters (especially us using Nikon software to edit it).
Comment 40 Marcel Wiesweg 2009-09-12 15:54:26 UTC
SVN commit 1022775 by mwiesweg:

Use PreviewThread API properly in slide show so that color management is enabled.

CCBUG: 195050

 M  +6 -6      slideshow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1022775
Comment 41 Marcel Wiesweg 2009-09-12 16:05:09 UTC
SVN commit 1022778 by mwiesweg:

Read color space from RAW file Exif when extracting embedded JPEG for preview

CCBUG: 195050

 M  +14 -4     previewtask.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1022778
Comment 42 Marcel Wiesweg 2009-09-12 16:05:47 UTC
Anything left for this bug?
Comment 43 Matti Rintala 2009-09-12 20:45:37 UTC
Hi Marcel,

Thanks again for working on this bug, it's much appreciated!

For me, color profiles seem to work for jpegs now, but still each nef raw file looks different depending on the colour profile used.

I tried it by using several versions of the same nef file, converted to different profiles. I stored the files both as nef and jpeg. The files all looked identical in GQView, so profile conversion should be ok. In Digikam (built from trunk after your message) all jpegs look identical, but each raw file looks different, like colour conversion was not performed (or at least the embedded profile was not used).
Comment 44 Marcel Wiesweg 2009-09-13 18:13:49 UTC
SVN commit 1022958 by mwiesweg:

Restructure color space detection code (remove code duplication).
Take into account that sometimes Exif.Image.ColorSpace field is missing altogether
when Nikon Makernote color tags are set.

CCBUG: 195050


 M  +55 -70    kexiv2image.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1022958
Comment 45 Marcel Wiesweg 2009-09-13 18:20:39 UTC
SVN commit 1022966 by mwiesweg:

In preview and thumbnail tasks, when loading an embedded raw preview, read the Icc profile
from metadata if available.
Optimize DMetadata creation in ThumbnailCreator.

CCBUG: 195050

 M  +8 -11     previewtask.cpp  
 M  +8 -6      thumbnailcreator.cpp  
 M  +3 -2      thumbnailcreator.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1022966
Comment 46 Marcel Wiesweg 2009-09-13 18:27:44 UTC
Fortunately the ICC profile embedded in the NEF for the embedded preview, which I had not thought of before, is available from libexiv2.

For me (with latest libkexiv2) the three NEF files from the D300 look all three ok now, but the D40 files each look different. For each d40/d300 pair, the same profiles are loaded (Adobe RGB (1998) for -adobergb.nef; sRGB IEC61966-2.1 for -srgb.nef; embedded Nikon Adobe RGB 4.0.0.3000 for -srgb-to-adobergb.nef)
Comment 47 Matti Rintala 2009-09-14 09:27:00 UTC
Marcel,

After your latest commits, nef raw files with profiles work, thanks!

I'll have to check again the files stored in-camera as AdobeRGB. Especially with D40 it is possible that the camera does its processing a little bit differently for files stored in AdobeRGB. In addition to AdobeRGB, D40 actually has two sRGB settings with a little colour reproduction. One sRGB setting should produce more pleasing skin tones, the other enhances colours in nature, if I remember properly.

However, in D300 Nikon started using Picture Controls which define colour and tonal settings, and sRGB/AdobeRGB setting was separated from them. That's why  sRGB and AdobeRGB versions should match closely with D300.

With the files converted to AdobeRGB with Capture NX2, it's possible that there are some minor differences compared to the original sRGB nef, since Capture NX2 might use a little bit different (better) raw-decoding algorithm than the camera.


I'll have time to test this better tomorrow, but so far things look good! :-)
Comment 48 Matti Rintala 2009-09-14 09:56:35 UTC
Marcel,

I had a little time to do one small test now, and I'm a little bit unsure if AdobeRGB is working properly for me (for both jpeg and raw nef).

For me, the green is paler in AdobeRGB version, which suggests that Digikam would still be interpreting it as sRGB.

I took the photo shot with D300 and stored in-camera as AdobeRGB. I then used ImageMagick's convert-command to convert it explicitly from AdobeRGB to sRGB. in Digikam, the resulting image is practically identical with the image shot in-camera as sRGB, but it does look different from the original AdobeRGB version.

I still get the following messages:

digikam(5934)/digikam (core) Digikam::DImg::load: "/home/bitti/local/edited-photos/nobackup/digikamtest/d300-adobergb.jpg"  : JPEG file identified
digikam(5934)/digikam (core): No input profile: invalid Behavior flags 1048576
Comment 49 Marcel Wiesweg 2009-09-14 20:11:42 UTC
I have indeed fixed two or three related bugs. I can't say exactly how this affected you, but it may. For me the d300-adobergb images look identical now. Does it for you with latest trunk?
Comment 50 Marcel Wiesweg 2009-09-25 21:17:35 UTC
All remaining issues have been cleared.