Calculate colour temperature in K

前端 未结 6 1053
忘掉有多难
忘掉有多难 2021-01-07 19:55

I have written a lib for working with colours and stuck trying to calculate Tc(k). From what I have read working in the CIE 1931 XYZ colour space i

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-07 20:02

    The Wikipedia states that the color temperature is calculated by considering the u-v chromaticities, not x-y, so you have to perform a translation. That said, I recommend using an approximation (also explained in the Wikipedia) as suggested by @sixlettervariables.

    The real question is, what are you trying to find the color temperature of?. I see a reference (#FF0000) to RGB colors, which are meaningless without stating a color space. Supposing you are in sRGB (so I can point you at Wikipedia again), you have to first obtain the linear RGB co-ordinates before proceeding to XYZ.

提交回复
热议问题