def _get_colors(self, f):
'''
Misterious function, ask @inconvergent :)
'''
scale = 1./255.
im = Image.open(f)
w, h = im.size
rgbim = im.convert('RGB')
res = []
for i in xrange(0, w):
for j in xrange(0, h):
r, g, b = rgbim.getpixel((i, j))
res.append((r*scale, g*scale, b*scale))
np.shuffle(res)
self.colors = res
self.n_colors = len(res)
评论列表
文章目录