Skip to content

Instantly share code, notes, and snippets.

@duhaime
Last active March 18, 2021 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save duhaime/61a776980471bec1224f2e2e79514aaa to your computer and use it in GitHub Desktop.
Save duhaime/61a776980471bec1224f2e2e79514aaa to your computer and use it in GitHub Desktop.
Color thief top colors
from colorthief import ColorThief
import matplotlib.pyplot as plt
import numpy as np
color_thief = ColorThief('cat.jpg')
palette = color_thief.get_palette(color_count=8)
arr = np.array(palette).astype(float) / 255
plt.imshow([arr])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment