3 ms·
Maybe I'm blind, but I don't see any handling of out-of-gamut colors? At the very minimum I'd expect some naive min/max clipping to avoid negative RGB component
by magicalhippo 6y ago
Maybe I'm blind, but I don't see any handling of out-of-gamut colors? At the very minimum I'd expect some naive min/max clipping to avoid negative RGB components.
Also no mention of what kind of RGB it is. From the xyzToRgb function it seems to be[1] sRGB but that should be mentioned, and also consistent throughout the library (in case it isn't).
[1]: http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix....
- kelsolaar 6y agoNegative numbers are not really an issue, quite the opposite because they are necessary for invertibility of most of the computations. We almost never ever clip values in Colour (https://github.com/colour-science/colour https://github.com/colour-science/colour) and leave that responsibility to the user. One exception is conversion to Hexadecimal where if you don't do ensure the values are in the range [0, 1], you will induce the user in error: https://github.com/colour-science/colour/issues/584#issuecomment-623042539 https://github.com/colour-science/colour/issues/584#issuecom...
- magicalhippo 6y ago> leave that responsibility to the user I think it would be better to have a function in the library that does this. Then it can be extended to allow for more clever things than a simple min/max clamp.
- kelsolaar 6y agoGamut mapping is not an easy thing though!
- magicalhippo 6y agoThat is true :) Color is a great example of how "low-order" approximations are very useful, and how quickly it can get very hard once you want to go a bit beyond that.