Catch KeyError on image.info dictionary

This commit is contained in:
Kevin Postal 2011-12-03 20:04:06 -08:00 committed by Matthew Tretter
parent 8bab75b331
commit eda3fc3c91

View file

@ -227,7 +227,10 @@ class AutoConvert(object):
matte = True
elif img.mode == 'P':
if self.format in PALETTE_TRANSPARENCY_FORMATS:
self.save_kwargs['transparency'] = img.info['transparency']
try:
self.save_kwargs['transparency'] = img.info['transparency']
except KeyError:
pass
elif self.format in RGBA_TRANSPARENCY_FORMATS:
# Currently PIL doesn't support any RGBA-mode formats that
# aren't also P-mode formats, so this will never happen.