This line :
if current_color!= _colors[0] and current_color!= _colors[1] and current_color!= _colors[2] and current_color!= _colors[3] and current_color!= _colors[4] and current_color!= _colors[5] and current_color!= _colors[6] and current_color!= _colors[7]:
always returns True
, so you iterate over the whole picture, changing it to black. getpixel
returns a tuple :
>>> print picture.getpixel((1, 1))
(79, 208, 248)
and you compare it to a list( [0,128,0]
). They are not the same:
>>> (1,2,3) == [1,2,3]
False
change colors
to a list of tuples rather than a list of lists.