'RGB to HSV wrong in colorsys?

I'm using the colorsys lib of Python:

import colorsys
colorsys.rgb_to_hsv(64, 208, 61)

output:(0.16666666666666666, 0, 208)

But this output is wrong, this is the true value using a RGB to HSV online converter: RGB to HSV

What's going on?



Solution 1:[1]

To avoid errors like this you can use colorir. It uses colorsys under the hood but allows for format specification:

>>> from colorir import sRGB
>>> sRGB(64, 208, 61).hsv(round_to=1)
HSV(118.8, 0.7, 0.8)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aleferna2001