Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luv and LCHuv gives incorrect color values for low lightness cyan #534

Open
jensln opened this issue Oct 29, 2023 · 1 comment
Open

Luv and LCHuv gives incorrect color values for low lightness cyan #534

jensln opened this issue Oct 29, 2023 · 1 comment

Comments

@jensln
Copy link

jensln commented Oct 29, 2023

The Luv and LCHuv color spaces jumps to an unexpected hue even though the color parameters are constant and only the lightness is varying. These images speaks for themselves. Minimal reproducible example in Pluto, showing the incorrect colors:

image

Also visible in the website, choosing the relevant parameters, as demonstrated on my phone:

@kimikage
Copy link
Collaborator

kimikage commented Apr 6, 2024

Basically, Colors.jl does not perform gamut clamping in color conversion.

Since RGB{N0f8} can only represent the component values between 0 and 1, it is clamped by the component type restriction, but that does not imply "clamping by gamut”.
In fact, RGB{Float64}(1.2, 0.0, -0.2) is a valid value in a sense (whether or not it is handled well).

Even if a color cannot be represented in RGB (especially sRGB), that color may be represented in other color models or color gamuts.
Therefore, on the part of Luv, the value cannot be restricted without consensus or standard rules.
In other words, this is a problem on the RGB side, the destination of the conversion.

However, as far as I know, there is no low-cost and accurate way to evaluate whether a given Luv color falls within the sRGB gamut.
This is the reason why such false colors are left unchecked.

To begin with, the cost of conversion between Luv and RGB is expensive.
The additional computing cost may not be a concern.
I do not know about the labor costs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants