dynamically getting colors, instead of setting it to 255

This commit is contained in:
Ryan Bagwell 2011-09-25 17:53:51 -05:00
parent b96a3f53a5
commit ff07e4e247

View file

@ -7,7 +7,7 @@ def img_to_fobj(img, format, **kwargs):
#preserve transparency if the image is in Pallette (P) mode
if img.mode == 'P':
kwargs['transparency'] = 255
kwargs['transparency'] = len(img.split()[-1].getcolors())
else:
img.convert('RGB')