[New-bugs-announce] [issue29629] rgb_to_hls to colorsys.py

Madhavendra Sharma report at bugs.python.org
Thu Feb 23 00:55:34 EST 2017


New submission from Madhavendra Sharma:

Calculations in rgb_to_hls at line number 67 in python version 2.7.3 for "h" the hue component are not correct according reference mentioned in the same source file "en.wikipedia.org/wiki/HSV_color_space".


code snippet:

    if r == maxc:
        #h = (bc-gc) #current code
        h = (bc-gc)%6 # suggestion
    elif g == maxc:
        h = 2.0+rc-bc
    else:
        #h = 4.0+gc-rc #current code
        h = 4.0+rc-gc # suggestion

    #h = (h/6.0) % 1.0 not required 
    
    # h = 60 *h # component should be multiplied by 60 but it depends on user

----------
messages: 288410
nosy: madhavendra.sharma
priority: normal
severity: normal
status: open
title: rgb_to_hls to colorsys.py
type: behavior
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29629>
_______________________________________


More information about the New-bugs-announce mailing list