mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 17:54:32 +03:00
bring ImageColor.getcolor into line with Convert.c implementation
This commit is contained in:
parent
fa1deca144
commit
038f9daf27
|
@ -134,7 +134,9 @@ def getcolor(color, mode):
|
||||||
|
|
||||||
if Image.getmodebase(mode) == "L":
|
if Image.getmodebase(mode) == "L":
|
||||||
r, g, b = color
|
r, g, b = color
|
||||||
color = (r * 299 + g * 587 + b * 114 + 500) // 1000
|
# ITU-R Recommendation 601-2 for nonlinear RGB
|
||||||
|
# scaled to 24 bits to match the convert's implementation.
|
||||||
|
color = (r * 19595 + g * 38470 + b * 7471 + 0x8000) >> 16
|
||||||
if mode[-1] == "A":
|
if mode[-1] == "A":
|
||||||
return (color, alpha)
|
return (color, alpha)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user