https://bugs.kde.org/show_bug.cgi?id=505272
Bug ID: 505272 Summary: Imprecise/Wrong sRGB output from LCMS2 Classification: Applications Product: krita Version First unspecified Reported In: Platform: Ubuntu OS: All Status: REPORTED Severity: normal Priority: NOR Component: Color models Assignee: krita-bugs-n...@kde.org Reporter: xp8...@outlook.com Target Milestone: --- SUMMARY LCMS2 will do sRGB curve-fitting to pow 2.2 if `cmsFLAGS_NOOPTIMIZE` is not set for `cmsCreateTransform()` calls under specific conditions, this leads to noticeably incorrect result especially around dark regions when outputting image from LCMS. From a quick search in Krita code base, I don't see this flag present in places where it's actually needed for correctness. This can be a non-bug for krita ONLY IF `cmsFLAGS_NOOPTIMIZE` is set for `cmsCreateTransform()` so that LCMS2 will convert the pixels properly via sRGB transfer curves for output. I am the developer of [OurPaint](https://www.WellObserve.com/OurPaint) and just today I found out why the result is different than doing the color space conversion algorithm manually. I have reported the same thing on [LCMS2](https://github.com/mm2/Little-CMS/issues/496) as well. Krita seems to have the same thing going on, but I doubt if anybody is serious enough to pixel-peep the output. STEPS TO REPRODUCE By "the look": If you are a seasoned artist, and if you observe darker lines/regions in your krita canvas exported "just a little bit darker/richer", then that's the exact problem I'm describing. (Effect more pronounced if use Clay/AdobeRGB compatible color spaces on your canvas) It's quite tedious to reproduce completely via krita _and_ to get an observable result from the start, but you could try doing it like this: 1. Set a new image to 16bit, Rec2020-ellie-v4-g10.icc (anything that has a different primaries than sRGB and a linear transfer curve. 2. Draw a linear gradient from black to white across the image. 3. Export as PNG, make sure that "convert to sRGB" is selected. This is image `A` 4. Export as PNG, disable "Embed sRGB tag" and convert to sRGB". This is image `B` 5. Open both images in GIMP and convert `B` to something like a Rec2020 but with sRGB transfer function, , then convert the result to sRGB, now you got `B1` (This is the guaranteed correct transform I found for now) 6. In GIMP convert `B` straight to sRGB, you get `B2` (This is broken the same way as krita since both uses lcms2) OBSERVED RESULT - `A` matches `B2` - B1 and B2 is slightly different especially at dark parts. EXPECTED RESULT - Both `B1`, `B2` matches `A` (3 identical images, with maybe off-by-1 conversion errors) SOFTWARE/OS VERSIONS (available in the Info Center app, or by running `kinfo` in a terminal window) Linux/KDE Plasma: Ubuntu 22.05 KDE Plasma Version: - KDE Frameworks Version: - Qt Version: 5? ADDITIONAL INFORMATION -- You are receiving this mail because: You are watching all bug changes.