yuki-koyama / color-util

A header-only C++11 library for colors; color space converters for RGB, HSL, XYZ, Lab, etc. and perceptual color difference calculators such as CIEDE2000
MIT License
98 stars 6 forks source link

XYZ to RGB debug #24

Open ChenJash opened 1 year ago

ChenJash commented 1 year ago

Thank you for your code. I use C++to process colors temporarily, and these codes have provided me with some convenience.

An error was found in the XYZ_to_RGB.hpp

There is an error in the calculation order of converting linear rgb to srgb in line 19. The correct order is:

std:: pow (linear srgb color (i), 1.0/2.4) * 1.055-0.055

Perhaps you can verify and fix this issue.

yuki-koyama commented 10 months ago

Thanks for pointing this out! It seems that my equation was wrong. I am not sure why it passed the test ( https://github.com/yuki-koyama/color-util/blob/8db4b1dc29f9847063852711f39b523aaa37d3af/tests/conversions/main.cpp#L43 ), but anyway the equation should definitely be fixed.