python提取图片配色

安装Haishoku

1
pip install haishoku

使用Haishoku

1
2
3
4
5
6
7
8
9
10
11
12
13
14
from haishoku.haishoku import Haishoku

image = 'cat.jpg'
haishoku = Haishoku.loadHaishoku(image)

# 图片的主色调
print(haishoku.dominant)
# 预览主色调
Haishoku.showDominant(image)

# 获取配色方案
print(haishoku.palette)
# 预览配色方案
Haishoku.showPalette(image)
0%