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

Query regarding TSL color space implementation #53

Open
blaine12100 opened this issue Aug 8, 2023 · 2 comments
Open

Query regarding TSL color space implementation #53

blaine12100 opened this issue Aug 8, 2023 · 2 comments

Comments

@blaine12100
Copy link

Hi

I'm trying to implement the TSL colour space in Python. I've referred to your implementation and the Wikipedia source for this. In your implementation, you do not follow the Wikipedia format entirely as it mentions that the R, G, and B values need to be gamma corrected. And even your implementation of Tint values is different. Can you shed some light on this?

@dy
Copy link
Member

dy commented Aug 9, 2023

About tint value - @Artoria2e5 recently made an optimization.
About difference with wiki - unfortunately I can't remember the details why it's done so. I should've commented the reasoning better. I wonder if tests fail or this solution diverges from canonical.
As for gamma-correction - there's a chance it was missed out. You're welcome to propose fix if you'd like to.
I would not use this implementation as source of truth.

@Artoria2e5
Copy link
Contributor

Artoria2e5 commented Aug 9, 2023

I wrote both the Wikipedia bits and the code here, so these descriptions should be the same. An explanation follows.

  • Gamma correction: The input RGB color space in this repo is the web sRGB color space, which indeed is gamma corrected. "Correction" means to make the values non-linear, not to remove the gamma and make it linear.
  • Tint: They are the exact same. Compare: and
    T = g_ != 0 ? 0.5 - Math.atan2(g_, r_) / 2 / Math.PI : 0,
    .

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

3 participants