[issue40668] Catastrophic loss of precision in colorsys module

Serhiy Storchaka report at bugs.python.org
Tue May 19 10:25:15 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

It is correct. Colorspaces for RGB an YIQ are different. Not all RGB colors can be represented in YIQ and vice versa. For YIQ color (0, 1, 0) you need RGB color (0.9468822170900693, -0.27478764629897834, -1.1085450346420322), but the G and B components are out of the range [0, 1]. So yiq_to_rgb() returns the closes RGB color to the original code, and it is (0.9468822170900693, 0, 0). It is the best that you can get.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40668>
_______________________________________


More information about the Python-bugs-list mailing list