Merge pull request #97 from olt/pil-png-transp-backport

Python 3 compatibility for PNG/ZIP improvements
This commit is contained in:
Alex Clark ☺ 2013-03-13 04:28:32 -07:00
commit eebd284d42
2 changed files with 4 additions and 4 deletions

View File

@ -628,10 +628,10 @@ class Image:
self.palette.mode = "RGB"
self.palette.rawmode = None
if "transparency" in self.info:
if isinstance(self.info["transparency"], str):
self.im.putpalettealphas(self.info["transparency"])
else:
if isinstance(self.info["transparency"], int):
self.im.putpalettealpha(self.info["transparency"], 0)
else:
self.im.putpalettealphas(self.info["transparency"])
self.palette.mode = "RGBA"
if self.im:

View File

@ -932,7 +932,7 @@ _getpalettemode(ImagingObject* self, PyObject* args)
return NULL;
}
return PyString_FromString(self->image->palette->mode);
return PyUnicode_FromString(self->image->palette->mode);
}
static inline int