Convert RGB color to English color name, like 'green' with Python

后端 未结 4 635
再見小時候
再見小時候 2020-11-30 19:39

I want to convert a color tuple to a color name, like \'yellow\' or \'blue\'

>>> im = Image.open(\"test.jpg\")
>>> n, color = max(im.getcol         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 20:18

    There is a program called pynche which can change RGB to colour name in English for Python.

    You can try to use the method ColorDB.nearest() in ColorDB.py which can do what you want.

    You can find more information about this method here : ColorDB Pynche

提交回复
热议问题