99designs / colorific

Automatic color palette detection
ISC License
700 stars 55 forks source link

new python-colormath breaks colorific #17

Closed mfeif closed 10 years ago

mfeif commented 10 years ago

They're doing some pretty major overhauls to python-colormath...

larsyencken commented 10 years ago

Thanks for letting us know. Did it give you a stacktrace?

mfeif commented 10 years ago

Yep:

>>> from PIL import Image

>>> from colorific import extract_colors

>>> palette = extract_colors(Image.open('/Users/mjf/Desktop/download.png')) 
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-e7657c8c6f75> in <module>()
----> 1 palette = extract_colors(Image.open('/Users/mjf/Desktop/download.png'))

/Users/mjf/venv/twnkl.notebook/lib/python2.7/site-packages/colorific.pyc in extract_colors(filename_or_img, min_saturation, min_distance, max_colors, min_prominence, n_quantized)
    141             aggregated[c] += n
    142         else:
--> 143             d, nearest = min((distance(c, alt), alt) for alt in aggregated)
    144             if d < min_distance:
    145                 # nearby match

/Users/mjf/venv/twnkl.notebook/lib/python2.7/site-packages/colorific.pyc in <genexpr>((alt,))
    141             aggregated[c] += n
    142         else:
--> 143             d, nearest = min((distance(c, alt), alt) for alt in aggregated)
    144             if d < min_distance:
    145                 # nearby match

/Users/mjf/venv/twnkl.notebook/lib/python2.7/site-packages/colorific.pyc in distance(c1, c2)
    102 def distance(c1, c2):
    103     "Calculate the visual distance between the two colors."
--> 104     return RGBColor(*c1).delta_e(RGBColor(*c2), method='cmc')
    105 
    106 def rgb_to_hex(color):

AttributeError: 'RGBColor' object has no attribute 'delta_e'
larsyencken commented 10 years ago

I pinned colorific to a known good version of colormath, and made a new 0.2.2 release. Please reopen this if you still run into this problem.