7 c / 12.92 if c < .03928 else ((c + .055) / 1.055) ** 2.4
10 return .2126 * rgb[0] + .7152 * rgb[1] + .0722 * rgb[2]
20 def algo_contrast_or_hue(img, colors):
21 rgb = img.convert('RGB').resize((1, 1)).getpixel((0, 0))
29 hue = img.convert('HSV').resize((1, 1)).getpixel((0, 0))[0]
32 key=lambda c: cdist(hue, c['hsv'][0]) ** 2 + (lumi - c['luminance']) ** 2
36 def is_very_bright(img):
37 rgb = img.convert('RGB').getpixel((0, 0))