In [53]:
%matplotlib inline
from vscope import Grid, Image, Analyzer

In [2]:
grid = Grid()




In [42]:
grid.images[11].permalink


Out[42]:
u'http://slowed.vsco.co/media/565ce84448331ed6618b457e'

In [54]:
%%timeit
top_colors = Analyzer.find_primary_colors(grid.images[11], resolve_to_n_colors=8)


1 loops, best of 3: 3.14 s per loop

In [52]:
top_colors_hex = []
for color in top_colors[0]:
    convert = lambda c: [str(hex(x))[2:-1].rjust(2, '0') for x in c]
    hex_color = '#{}{}{}'.format(*convert(color))
    top_colors_hex.append(hex_color)
top_colors_hex


Out[52]:
['#dbd0c5',
 '#1a271b',
 '#374b3c',
 '#888577',
 '#3a4f65',
 '#e0c36e',
 '#ab2716',
 '#743b28']

In [50]:
import matplotlib.pyplot as plt
import matplotlib.patches as patches

fig6 = plt.figure()
ax6 = fig6.add_subplot(111, aspect='equal')
patcher = lambda c, i: patches.Rectangle(
        (0.03 + (0.06 * i), 0.2), 0.2, 0.6,
        facecolor=c      # Default
    )
patches = [patcher(c, i) for i, c in enumerate(top_colors_hex)]
for p in patches:
    ax6.add_patch(p)
# fig6.savefig('rect6.png', dpi=90, bbox_inches='tight')
fig6.savefig('rect6.png', figsize=(20, 16), dpi=360, bbox_inches='tight')