Bug 443635 (Lab) - In LAB color mode, 32bit float, The gamma value 2.2 was incorrectly applied. It should work in linear gamma 1.0
Summary: In LAB color mode, 32bit float, The gamma value 2.2 was incorrectly applied. ...
Status: RESOLVED INTENTIONAL
Alias: Lab
Product: krita
Classification: Applications
Component: Color models (show other bugs)
Version: 5.0.0-beta2
Platform: Other Other
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-12 10:41 UTC by LCH
Modified: 2021-10-13 04:45 UTC (History)
2 users (show)

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


Attachments
OBSERVED RESULT EXPECTED (36.54 KB, application/zip)
2021-10-12 10:41 UTC, LCH
Details

Note You need to log in before you can comment on or make changes to this bug.
Description LCH 2021-10-12 10:41:23 UTC
Created attachment 142363 [details]
OBSERVED RESULT EXPECTED

SUMMARY
In LAB color mode, 32bit float, The gamma value 2.2 was incorrectly applied. It should work in linear gamma 1.0
http://www.ericbrasseur.org/gamma.html
Read this. This caused a bug.

STEPS TO REPRODUCE
1. Go to LAB color mode.
2. Adjust the picture to 50% size. or, You can also apply a radius of 2 pixels Gauss Blur.
3. Exported to PNG.

OBSERVED RESULT
Look attachment.

EXPECTED RESULT
Look attachment.

SOFTWARE/OS VERSIONS
Windows: 11
macOS: 11Big Sur
Linux/KDE Plasma: Ubuntu latest LTS
KDE Frameworks Version: 5.0-beta2
Qt Version: 5.0-beta2

ADDITIONAL INFORMATION
GIMP does not have this BUG, Fixed in 2.10.
Comment 1 Dmitry Kazakov 2021-10-12 11:04:11 UTC
Well, there is no 2.2 gamma in Lab. If the scaling happened in 2.2 gamma, the result would be totally gray. But Krita generate almost correct image (don't forget to set filtering to bilinear).

The slightly yellowish tone is probably related to the the difference in white point (D50 for Lab and D65 for sRGB).

I have pink and green stripes on the top and bottom of the image which I cannot explain right not. But otherwise, the behavior looks correct.
Comment 2 Dmitry Kazakov 2021-10-12 11:10:18 UTC
Scaling in sRGB-elle-V2-g10.icc color space doesn't produce and yellowing tone, so that confirms the white point difference hypothesis.

The only "real" issue here are the colored stripes on the border of the image. But I'm not sure if we should classify that as a bug.
Comment 3 LCH 2021-10-12 11:20:12 UTC
(In reply to Dmitry Kazakov from comment #1)
> Well, there is no 2.2 gamma in Lab. If the scaling happened in 2.2 gamma,
> the result would be totally gray. But Krita generate almost correct image
> (don't forget to set filtering to bilinear).
> 
> The slightly yellowish tone is probably related to the the difference in
> white point (D50 for Lab and D65 for sRGB).
> 
> I have pink and green stripes on the top and bottom of the image which I
> cannot explain right not. But otherwise, the behavior looks correct.

You're so wrong!

Please do the same with gimp. Gimp produces a really correct image.
In LAB, the image generated by krita is completely wrong.
Convert to an RGB 32bit float and do the same and you'll get the really correct image. Gimp does not require this step. This is because gimp always performs 32bit floating-point linear gamma internally.

Remember to export as png for external viewing. The krita preview is also an error!
Comment 4 LCH 2021-10-12 11:26:33 UTC
(In reply to Dmitry Kazakov from comment #2)
> Scaling in sRGB-elle-V2-g10.icc color space doesn't produce and yellowing
> tone, so that confirms the white point difference hypothesis.
> 
> The only "real" issue here are the colored stripes on the border of the
> image. But I'm not sure if we should classify that as a bug.

Your white dot difference assumption is completely wrong.
In gimp LAB, use Krita LAB icc file, Do the same thing, LAB produce the same image as RGB.
Comment 5 wolthera 2021-10-12 14:38:09 UTC
Hi,

We do not do any special conversions to linear in Krita when dealing with transforms. If a user wants to have linear space color calculations, they should work in a linear space (Lab, for what it's worth, is not 'gamma 2.2', it's 'L*'). We do this because doing such conversions can make life really hard for people editing non-color data such as normal and height maps.
Comment 6 LCH 2021-10-13 04:44:17 UTC
(In reply to Dmitry Kazakov from comment #2)
> Scaling in sRGB-elle-V2-g10.icc color space doesn't produce and yellowing
> tone, so that confirms the white point difference hypothesis.
> 
> The only "real" issue here are the colored stripes on the border of the
> image. But I'm not sure if we should classify that as a bug.

I was so wrong. I'm sorry to bother you because of my mistake. Wishing you a happy holiday in advance.
in LAB 32bit Float, I used Nuke to verify my error. Krita behaves in the same way as Nuke. The results of both are correct!
Comment 7 LCH 2021-10-13 04:45:34 UTC
(In reply to wolthera from comment #5)
> Hi,
> 
> We do not do any special conversions to linear in Krita when dealing with
> transforms. If a user wants to have linear space color calculations, they
> should work in a linear space (Lab, for what it's worth, is not 'gamma 2.2',
> it's 'L*'). We do this because doing such conversions can make life really
> hard for people editing non-color data such as normal and height maps.

I was so wrong. I'm sorry to bother you because of my mistake. Wishing you a happy holiday in advance..
in LAB 32bit Float, I used Nuke to verify my error, Krita behaves in the same way as Nuke, The results of both are correct!