Revert "Added support for PNG images with transparency palette"

This reverts commit 5baa1ac1b8.
This commit is contained in:
Oliver Tonnhofer 2013-03-11 19:02:54 +01:00
parent 1db3f9d53f
commit c60bb09fcd
4 changed files with 10 additions and 26 deletions

View File

@ -616,11 +616,7 @@ class Image:
self.palette.mode = "RGB" self.palette.mode = "RGB"
self.palette.rawmode = None self.palette.rawmode = None
if "transparency" in self.info: if "transparency" in self.info:
if self.info["transparency_palette"]: self.im.putpalettealpha(self.info["transparency"], 0)
self.im.putpalettealpha(0, 0, self.info["transparency_palette"])
else:
self.im.putpalettealpha(self.info["transparency"], 0)
self.palette.mode = "RGBA" self.palette.mode = "RGBA"
if self.im: if self.im:
return self.im.pixel_access(self.readonly) return self.im.pixel_access(self.readonly)

View File

@ -254,7 +254,6 @@ class PngStream(ChunkStream):
i = s.find(b"\0") i = s.find(b"\0")
if i >= 0: if i >= 0:
self.im_info["transparency"] = i self.im_info["transparency"] = i
self.im_info["transparency_palette"] = s
elif self.im_mode == "L": elif self.im_mode == "L":
self.im_info["transparency"] = i16(s) self.im_info["transparency"] = i16(s)
elif self.im_mode == "RGB": elif self.im_mode == "RGB":

View File

@ -741,13 +741,13 @@ _convert(ImagingObject* self, PyObject* args)
return NULL; return NULL;
if (paletteimage != NULL) { if (paletteimage != NULL) {
if (!PyImaging_Check(paletteimage)) { if (!PyImaging_Check(paletteimage)) {
PyObject_Print((PyObject *)paletteimage, stderr, 0); PyObject_Print((PyObject *)paletteimage, stderr, 0);
PyErr_SetString(PyExc_ValueError, "palette argument must be image with mode 'P'"); PyErr_SetString(PyExc_ValueError, "palette argument must be image with mode 'P'");
return NULL; return NULL;
} }
if (paletteimage->image->palette == NULL) { if (paletteimage->image->palette == NULL) {
PyErr_SetString(PyExc_ValueError, "null palette"); PyErr_SetString(PyExc_ValueError, "null palette");
return NULL; return NULL;
} }
} }
@ -1415,9 +1415,7 @@ _putpalettealpha(ImagingObject* self, PyObject* args)
{ {
int index; int index;
int alpha = 0; int alpha = 0;
char* tpalette = NULL; if (!PyArg_ParseTuple(args, "i|i", &index, &alpha))
int tpaletteSize = 0;
if (!PyArg_ParseTuple(args, "i|i"PY_ARG_BYTES_LENGTH, &index, &alpha, &tpalette, &tpaletteSize))
return NULL; return NULL;
if (!self->image->palette) { if (!self->image->palette) {
@ -1431,15 +1429,7 @@ _putpalettealpha(ImagingObject* self, PyObject* args)
} }
strcpy(self->image->palette->mode, "RGBA"); strcpy(self->image->palette->mode, "RGBA");
self->image->palette->palette[index*4+3] = (UINT8) alpha;
if (tpaletteSize > 0) {
for (index = 0; index < tpaletteSize; index++) {
self->image->palette->palette[index*4+3] = (UINT8) tpalette[index];
}
}
else {
self->image->palette->palette[index*4+3] = (UINT8) alpha;
}
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
@ -3409,4 +3399,3 @@ init_imaging(void)
} }
#endif #endif

View File

@ -157,7 +157,7 @@ def testimage():
def check_module(feature, module): def check_module(feature, module):
try: try:
__import__(module) __import__("PIL." + module)
except ImportError: except ImportError:
print("***", feature, "support not installed") print("***", feature, "support not installed")
else: else: