Bug 411711

Summary: Curve Module : Drops do not behave correctly
Product: [Applications] digikam Reporter: Alexandre Belz <alexandre.belz>
Component: Plugin-Editor-CurvesAssignee: Digikam Developers <digikam-bugs-null>
Status: REPORTED ---    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.0.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screen capture of the bug.
Reference Pattern with Blacks, Whites, Greys, etc...
attachment-21223-0.html

Description Alexandre Belz 2019-09-08 13:18:24 UTC
SUMMARY
Using the drops to calibrate the curve leads to greyish picture.

STEPS TO REPRODUCE
1. Open a JPG in the editor (use attached pattern for instance)
2. Selet the "curve" tool
3. Select the black drop
4. Click on a black area
5. Select the white drop
6. Click on a white area


OBSERVED RESULT
The blackest point is moved up to a greyish value ; the white point is moved down to a greyish value.
The histogramm is compressed in a central area , close to middle values.

EXPECTED RESULT
I would expect the black drop to define luminance = 0 ; white drop to define luminance =255   (wide histogram).
Note that I expect global luminance adjustment (black;gamma;white) correction, not individual channel adjustment (RGB) that would lead to white balance drifts.

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
Please tell me if I can download & test 6.4.0 weekly build.
Comment 1 Alexandre Belz 2019-09-08 13:20:51 UTC
Created attachment 122537 [details]
Screen capture of the bug.
Comment 2 Alexandre Belz 2019-09-08 13:21:23 UTC
Created attachment 122538 [details]
Reference Pattern with Blacks, Whites, Greys, etc...
Comment 3 Maik Qualmann 2019-09-08 13:46:29 UTC
You expect it to set the luminance. The help about the drop but says something else. There it is clear that you set the darkest, medium or brightest color tone. And yes, that changes the white balance.

Maik
Comment 4 Alexandre Belz 2019-09-08 19:40:07 UTC
OK Maik, let's stay for the moment with the white balance affecting drops.

But any<aBlack and White drops : they compress the histogram instead of stretching it !
(try to put the black drop on a black part of a picture... it's not black anymore ! why ?)
Comment 5 Alexandre Belz 2019-09-08 19:41:03 UTC
OK Maik, let's stay for the moment with the white balance affecting drops.

But anyway Black and White drops result is strange : they compress the histogram instead of stretching it !
(try to put the black drop on a black part of a picture... it's not black anymore ! )
Comment 6 Alexandre Belz 2019-09-08 19:53:54 UTC
my reference is the Digikam handbook.
https://docs.kde.org/trunk5/en/extragear-graphics/digikam/photographic-editing.html

See chapter "Adjust Curves", from the lines "Below you can see a black and white photograph corrected in Luminosity channel... "
Black should stay black indeed.
Comment 7 Maik Qualmann 2019-09-08 20:21:40 UTC
Ok, here we have to ask Gilles if he knows what exactly this function should do. The function can be found here:

https://cgit.kde.org/digikam.git/tree/core/libs/dimg/filters/curves/curvessettings.cpp#n143

As you can see there are multipliers for dark, medium and bright. Medium is ok. Dark is 42. If I set it to 0, the function actually seems to work correctly. So why 42?

Maik

Maik
Comment 8 caulier.gilles 2019-09-08 21:12:54 UTC
Hi Maik,

Yes i know, as i implemented this code.

Very simple : 42 is to compute a black point from a low middle gray level. Is the same way 212 to compute a white point for high middle gray level.

This feature is inspired by Curve tool from Photoshop. You can capture a color from a region of image. Depending of tool use (low, middle, high gray), all settings are adjusted accordingly.

https://helpx.adobe.com/photoshop/using/curves-adjustment.html

Look B, C, and D tool from this tutorial.

Gilles Caulier
Comment 9 caulier.gilles 2019-09-08 21:16:46 UTC
For black point, if you set 0 instead 42, curves will be compressed. Idem for 212 instead 255 for white point.

Gilles Caulier
Comment 10 caulier.gilles 2019-09-08 21:19:41 UTC
Demo adjusting white point and black point to curves tool under Photoshop.

https://www.youtube.com/watch?v=8dX8YsJX1ko

Gilles Caulier
Comment 11 Alexandre Belz 2019-09-09 06:11:54 UTC
Created attachment 122552 [details]
attachment-21223-0.html

Hi Gilles,

i do observe strange things with the cuurent 42/212 values (that are neither black nor white value). Render is a bad greyish picture.

Photoshop help says
"When applying a Curves adjustment, use the black and white sliders to quickly set the black and white points (pure black and pure white values) in the image."
... so full scale adjustment, not mid tones.

I find this much more logical. Histogram should be stretched out by this function, not compressed.

please can you give a try on the current digikam version ? I'm pretty sure you'll understand my point.

-------- Message d'origine --------
De : bugzilla_noreply@kde.org
Date : 08/09/2019 23:19 (GMT+01:00)
À : alexandre.belz@live.fr
Objet : [digikam] [Bug 411711] Curve Module : Drops do not behave correctly

https://bugs.kde.org/show_bug.cgi?id=411711

--- Comment #10 from caulier.gilles@gmail.com ---
Demo adjusting white point and black point to curves tool under Photoshop.

https://www.youtube.com/watch?v=8dX8YsJX1ko

Gilles Caulier

--
You are receiving this mail because:
You reported the bug.
You voted for the bug.
Comment 12 Alexandre Belz 2019-09-29 11:11:08 UTC
Hello @Gilles, I still have issues on this one. 
Pointing the Black drop on a dark area adds too mcuh luminosity. which is not the expected result.
Black drop should set the black point.

Please can you double check why 0-255 could not be the right values for Black/White drops ?
Theorically, they should !
Comment 13 Alexandre Belz 2019-09-29 11:22:10 UTC
For reference, the module "Adjust Levels" also have Black/White Drops that work correctly.
(And the Grey drops does not modifiy the color balance, which is also a nice one).
Comment 14 Alexandre Belz 2019-12-25 20:41:12 UTC
Hi, please can you update me on this one ?
And in "Luminosity" graph, the grey drop should affect only the luminance, without changing the chrominance !
Comment 15 Alexandre Belz 2020-01-26 14:59:04 UTC
Hello Maik, Gilles
please could we work on that ticket ?

For reminder, I can't use the drops in module "Curves" : if I set the black point on a JPG, it leads to a greyish picture. Moreover, colors are modified even If I work in luminance mode (my graph is selected to "Luminance").

I recommend that we reuse the behaviour of the drops seen in the module "Adjust Levels" (black => really black ; colors are preserved).
Comment 16 Maik Qualmann 2020-01-26 20:05:31 UTC
Git commit c118922329949cdb902ce8334b8c961f5abdd4e3 by Maik Qualmann.
Committed on 26/01/2020 at 20:04.
Pushed by mqualmann into branch 'master'.

cleanup code, the function is unchanged

M  +16   -16   core/libs/dimg/filters/curves/curvessettings.cpp

https://invent.kde.org/kde/digikam/commit/c118922329949cdb902ce8334b8c961f5abdd4e3
Comment 17 caulier.gilles 2020-08-01 13:19:20 UTC
digiKam 7.0.0 stable release is now published:

https://www.digikam.org/news/2020-07-19-7.0.0_release_announcement/

We need a fresh feedback on this file using this version.

Thanks in advance

Gilles Caulier
Comment 18 Alexandre Belz 2020-08-03 05:53:28 UTC
Hi @Gilles,
OK, I will re-test this week.
Comment 19 Alexandre Belz 2020-08-03 11:08:34 UTC
Hello @Gilles,
I confirm that the bug persists with 7.0 :
- The blackest point is moved up to a grayish value ; the white point is moved down to a grayish value.
- The histogram is compressed in a central area , close to middle (grey) value.
Comment 20 caulier.gilles 2023-10-15 12:33:58 UTC
@Alexandre Belz,


This problem still reproducible with the new digiKam 8.2.0 pre-release Windows
installer available at usual place:

https://files.kde.org/digikam/

This new bundle is based on last Qt framework 5.15.11 and KDE framework 5.110.

Thanks in advance

Gilles Caulier