You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➜ gradify git:(master) ✗ python gradify.py -f bg.jpg
Traceback (most recent call last):
File "gradify.py", line 315, in <module>
foo = Gradify()
File "gradify.py", line 57, in __init__
self.get_file(self.args.file)
File "gradify.py", line 197, in get_file
self.get_directions(filen)
File "gradify.py", line 88, in get_directions
col = self.get_colors()
File "gradify.py", line 262, in get_colors
return self.findBestColors()
File "gradify.py", line 293, in findBestColors
diff = self.get_RGB_diff(col_dict["col"], self.colors[i][1])
File "gradify.py", line 266, in get_RGB_diff
return abs(1.4*abs(old[0]-new[0])**(1/2.0) + .8*abs(old[1]-new[1])**(1/2.0) + .8*abs(old[2]-new[2])**(1/2.0))**(1/2.0)
TypeError: 'int' object has no attribute '__getitem__'
➜ gradify git:(master) ✗ md5sum bg.jpg
d91c1f965139603990d138e39ba7b358 bg.jpg
➜ gradify git:(master) ✗ python -V
Python 2.7.6
➜ ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
➜ ~ uname -a
Linux gntpc 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
As far as I can tell, because the image only contains greys (x,x,x) PIL compresses the tuples to ints for some reason? I'll check if there's a more elegant way of preventing this rather than a hacky if to check the length of the tuple/int and extend it
Image: https://imgrush.com/2RwfllE5YDmQ.jpg
The text was updated successfully, but these errors were encountered: