Bug 493144 - Gradient preset in XYZ space converted to sRGB
Summary: Gradient preset in XYZ space converted to sRGB
Status: REPORTED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 5.2.3
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-15 09:13 UTC by Robert Moerland
Modified: 2024-09-15 13:04 UTC (History)
1 user (show)

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


Attachments
zip file with gradient presets as saved by Krita. All are XYZ layers in either an XYZA document or an RGBA document (1.47 KB, application/x-zip-compressed)
2024-09-15 09:13 UTC, Robert Moerland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Moerland 2024-09-15 09:13:44 UTC
Created attachment 173679 [details]
zip file with gradient presets as saved by Krita. All are XYZ layers in either an XYZA document or an RGBA document

SUMMARY
Adding a gradient preset while sampling colors from an XYZA document leads to different colors in the SVG file, depending on the color depth (int/float).

STEPS TO REPRODUCE
1. Create a new document in XYZA space, 16-bit float or int
2. Paint some colors
3. Use the gradient editor to add a new gradient, and sample colors from the image
4. Save the gradient

OBSERVED RESULT
On one document with floats, colors were converted to sRGB:
<stop stop-opacity="1" stop-color="#925a79 icc-color(sRGB, 0.5725337863, 0.3529411852, 0.4745250642)" offset="0" krita:stop-type="color-stop"/>

On another document with floats, it seems that the conversion is implicit (and the floating point style has disappeared):
<stop stop-opacity="1" stop-color="#00ff00" offset="0" krita:stop-type="color-stop"/>

On a document with ints:
<stop stop-opacity="1" stop-color="#d58764" offset="0" krita:stop-type="color-stop"/>

EXPECTED RESULT
Floating point color definitions from floating point sources in XYZ space

SOFTWARE/OS VERSIONS
Windows 10 Version 2009
Qt Version: 5.15.7

ADDITIONAL INFORMATION
The gradients seem to be saved properly (with icc-color) when, for example, a ClayRGB profile and the RGBA model are used to work in.
Comment 1 wolthera 2024-09-15 09:40:17 UTC
Yes, this is deliberate, because I kept running into compatibility issues with Inkscape when it came to XYZ values (like, their ranges were scaled weird at the time, I couldn't make sense of it). Given Inkscape is one of the very few applications to read icc-color, I decided that compatibility was more important.
Comment 2 Robert Moerland 2024-09-15 13:04:28 UTC
Thank you for the extra info. I did see a comment about that behavior in the merge request (https://invent.kde.org/graphics/krita/-/merge_requests/675). I also think that's a fair design decision. The only thing that bothers me a little bit then is that the conversion is done silently, i.e., there might be a loss of color accuracy but it's not explicitly mentioned. 

Perhaps this report could be converted into a wishbug/usability improvement, where I could see as a solution for example (thinking out loud):
1. Explicitly warn the user in the UI that XYZ colors are converted to sRGB in the gradient editor, or
2. Perhaps store colors picked from an XYZA document in RGB with the ACES2065-1 color profile?