LoginSignup
0
0

More than 5 years have passed since last update.

めざせpythonライブラリマスター (56)colorthief

Posted at

【ライブラリ説明】

 画像に使われている色を取得

【プログラム】

 こちらの画像を使いました。
 imoyokan.jpg

colorthief.py
# -*- coding: utf-8 -*-

from colorthief import ColorThief

color_thief = ColorThief('imoyokan.jpg')
# 1番多く使われている色
dominant_color = color_thief.get_color(quality=1)
print dominant_color
# (43, 37, 27)

# 使われている色を6種類に分ける
palette = color_thief.get_palette(color_count=6)
print palette
# [(212, 173, 94), (42, 36, 27), (104, 64, 46), (123, 100, 46), (231, 199, 154), (73, 84, 78)]

【参考サイト】

 pypi
 github

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0