이것은 단순한 문제처럼 보입니다. 정확히 colormath
을 위해 설계되었습니다. 그러나 convert_color
을 호출하면 전달 된 동일한 개체가 반환됩니다. the documentation에 따르면 실패한 변환은 UndefinedConversionError
을 발생시키고 개체를 반환하지 않아야합니다.python-colormath가 sRGB를 Adobe RGB로 변환 할 수없는 이유는 무엇입니까?
>>> from colormath.color_objects import sRGBColor, AdobeRGBColor
>>> from colormath.color_conversions import convert_color
>>> srgb = sRGBColor(0.0, 1.0, 0.0)
>>> srgb
sRGBColor(rgb_r=0.0,rgb_g=1.0,rgb_b=0.0)
>>> argb = convert_color(srgb, AdobeRGBColor)
>>> argb
sRGBColor(rgb_r=0.0,rgb_g=1.0,rgb_b=0.0)
>>> argb is srgb
True
그것은 일이 Lab
로 변환 할 않습니다 그래서 문제가 될 수있는 것을 확실 해요.
>>> from colormath.color_objects import LabColor
>>> convert_color(srgb, LabColor)
LabColor(lab_l=87.73500278716472,lab_a=-86.1829494051608,lab_b=83.1795364492565)