我使用color thief从图像中提取调色板。
如何将rgb值的图像创建为调色板?
from colorthief import ColorThief
color_thief = ColorThief('C:\Users\username\Desktop\index.jpg')
# get the dominant color
dominant_color = color_thief.get_color(quality=1)
print dominant_color
# build a color palette
palette = color_thief.get_palette(color_count=2)
print palette
输出:
(82, 129, 169)
[(82, 129, 169), (218, 223, 224), (147, 172, 193), (168, 197, 215), (117, 170, 212)]
预期输出类似于http://www.color-hex.com/color-palette/895,即一系列彩色矩形
答案 0 :(得分:1)