Or. half baked.
We 'support' a mode called PA which is palette with alpha, stored in 4 bytes per pixel. (FWIW, I think this all applies to LA as well)
Image.putpalette (https://github.com/python-pillow/Pillow/blob/master/PIL/Image.py#L1447) only allows for L or P images when adding a palette:
if self.mode not in ("L", "P"):
raise ValueError("illegal image mode")
_imaging.c:_putpalette Also only accepts* L and P. This code was in PIL:
if (strcmp(self->image->mode, "L") != 0 && strcmp(self->image->mode, "P")) {
PyErr_SetString(PyExc_ValueError, wrong_mode);
return NULL;
* or rather, it looks like it should but only actually accepts if mode ==Pand mode !='L'
TiffImagePlugin:_setup (https://github.com/python-pillow/Pillow/blob/master/PIL/TiffImagePlugin.py#L1137) only includes the palette for P images.
if self.mode == "P":
palette = [o8(b // 256) for b in self.tag_v2[COLORMAP]]
self.palette = ImagePalette.raw("RGB;L", b"".join(palette))
All of this found while checking out #1597.
Or. half baked.
We 'support' a mode called
PAwhich is palette with alpha, stored in 4 bytes per pixel. (FWIW, I think this all applies toLAas well)Image.putpalette(https://github.com/python-pillow/Pillow/blob/master/PIL/Image.py#L1447) only allows forLorPimages when adding a palette:_imaging.c:_putpaletteAlso only accepts*LandP. This code was in PIL:* or rather, it looks like it should but only actually accepts if
mode ==Pand mode !='L'TiffImagePlugin:_setup(https://github.com/python-pillow/Pillow/blob/master/PIL/TiffImagePlugin.py#L1137) only includes the palette forPimages.All of this found while checking out #1597.