Replies: 8 comments
-
I actually went for simpler: if np.any(RGB < 0):
usage_warning(
'"RGB" array contains negative values, those will be clipped, '
'unpredictable results may occur!')
RGB = np.clip(RGB, 0, np.inf)
if np.any(RGB > 1):
usage_warning(
'"RGB" array contains values over 1 and will be normalised, '
'unpredictable results may occur!')
RGB = eotf_inverse_sRGB(normalise_maximum(eotf_sRGB(RGB))) |
Beta Was this translation helpful? Give feedback.
-
Is this seemingly inconsistent behaviour? Gamut clipping on low and not on high would result in inconsistent differences between input chromaticity and output for either case? |
Beta Was this translation helpful? Give feedback.
-
The negative clipping handles (naively) gamut mapping and the positive normalisation handles potential HDR values, they are separate problems. There is no expectation to be able to roundtrip values and HEX input can only be in the range [0-1]. |
Beta Was this translation helpful? Give feedback.
-
I believe the “correct” output should be against the source gamut; that is, where values are negative or greater than source RGB, the destination values are out of gamut. Either outlier indicates out of gamut results, and I believe the proper approach would be to clip according to the resultant value exceeding the initial values? |
Beta Was this translation helpful? Give feedback.
-
The correct output is the one that will produce colours close to what they should be with all the caveats and warnings issued. Keeping in mind that we don't have gamut mapping, this would mean that whenever a user uses those xy chromaticity coordinates/ CIE xyY values: He does not get this colour out: Not this one either: But that one: We cannot presume that the user Y value in the SO example is representing absolute luminance values, so divided by 80 is actually not an option. |
Beta Was this translation helpful? Give feedback.
-
Agree on the absolute. Agree on the “better” gamut clip results here. I am curious if there is a difference between the gamut clip on zero before versus after normalization? Phoof that old behaviour. 🤣 |
Beta Was this translation helpful? Give feedback.
-
I haven't tried! To be fair, I'm expecting the users to have ensured that their values are representable properly, the new behaviour is mostly a cheap remedy that comes with some benefits:
Don't get me wrong, it is not ideal but it is certainly not worse! :) |
Beta Was this translation helpful? Give feedback.
-
Yep. I think it’s more of a thought process at this point. As in “if normalizing, should we normalize against peak Y = 1.0?” Which in turn implies normalizing against R=G=B == Y = 1.0. Side request: Can this be wired into the star sRGB star functions? Graph plotting explodes when sRGB is out of gamut. |
Beta Was this translation helpful? Give feedback.
-
So this is not really a defect per-see but more a consequence of working with unbounded values while still being able to produce colours for the web. I noticed it in the past and it has bitten me recently while answering that SO question: https://stackoverflow.com/questions/61455618/how-to-convert-cie-color-in-the-following-format-x-0-615-y-0-346-5-6-cd-m2/
I think there is a virtue with being able to convert even HDR and WGC in a decent way to Hexadecimal, at the very least, a red HDR colour should not come up as green!
I would be leaning toward something like that:
This is especially relevant with the Automatic Colour Conversion Graph.
Beta Was this translation helpful? Give feedback.
All reactions